
return text.toString();
}
/**
* check if a string is empty
* @param string string to test
* @return true if empty, false otherwise
*/
public static boolean isEmpty(String string)
{
if(null != string)
return string.trim().length() == 0;
else
return true;
}
/**
* Write the input in XML (or HTML) by escaping what
* must be escaped.
* @param writer write on this
* @param string string to write
* @exception IOException error writing
*/
public static void writeInXML(Writer writer,String string)
throws IOException
{
for(int i = 0;i < string.length();i++)
{
char c = string.charAt(i);
if(c == ‘<’)
writer.write(“<”);
else if(c == ‘&’)
writer.write(“&”);
else
writer.write(c); ...