Try this code:
try
{
String stringWithSpaces = " this is a test ";
StringBuffer sb = new StringBuffer();
for (int i=0;i<stringWithSpaces.length();i++)
{
if (!Character.isWhitespace(stringWithSpaces.charAt(i)))
sb = sb.append(stringWithSpaces.charAt(i));
}
String stringWithNoSpaces = sb.toString();
} catch (Exception e) {
out.println("<br>Error: "+e.getMessage());
e.printStackTrace(out);
}
Where 'stringWithNoSpaces' is the modified string.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets