It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

removing speechmarks from a string?

removing speechmarks from a string?

Postby computersaysno on Wed Dec 13, 2006 12:08 pm

I'm trying to remove speech marks from a string with the following code:

Code: Select all
       
if (currentToken.equalsIgnoreCase("PRINT"))   
{
    while (lineTok.hasMoreTokens())   
    {
        String newTok = lineTok.nextToken();   
        System.out.println(substitute(newTok,"""," ")); 
     }

}



but get 'unclosed string lateral' error message when i try to compile. Anyone know why, or know a better way to remove " ?

Thanks
computersaysno
 
Posts: 0
Joined: Wed Dec 13, 2006 12:05 pm

Re: removing speechmarks from a string?

Postby meongmania on Tue Dec 19, 2006 3:19 am

System.out.println(substitute(newTok,"""," "));



that's the cause of the error message.

java recognize " as a String marker, if u by some case want to use " not as a marker, but as a String value, u should use "\"" instead...
meongmania
 
Posts: 16
Joined: Tue Dec 19, 2006 2:58 am


Who is online

Users browsing this forum: No registered users and 1 guest