replace() inj class String is intended to to replace a character with another. If you want to replace spaces with an empty string you have to write your own function like this: public String removeBlanks(String aString) { StringBuffer mResult = new StringBuffer(); StringTokenizer mTokenizer = new StringTokenizer(aString, " "); while (mTokenizer.hasMoreElements()) { mResult.append(mTokenizer.nextToken()); } return mResult.toString(); } P.S.: This is a java question, not a tomcat question. > -----Ursprüngliche Nachricht----- > Von: Mark Franz [mailto:[EMAIL PROTECTED]] > Gesendet: Dienstag, 19. Dezember 2000 22:06 > An: '[EMAIL PROTECTED]' > Betreff: Replacing ALL Whitespace in string > > > I am trying to replace ALL the Whitespace in a string. If I do this; > > String newcat = newcat1.replace(' ',''); > > I get this error; > > 100. String newcat = newcat1.replace(' ',''); > <> > *** Lexical Error: Empty character constant > > > My newcat string might look like this; > > ROOT/cat Tree/The Next/Path To/Victory Garden > > > Mark G. Franz > > >