|
I think you might be getting a bit confused by my
usage of a String literal in this case. The LITERAL that I typed, required
the \" (per the Java Language Specification), but the character that shows up
when you print it out is ". Try printing out the input string in my
example. My example DOES work. Look at what it prints out. It
does exactly what you're asking for.
public class
StringReplace { public static void main( String[] args
) { String
input = "I turned the moon into something I like to call a \"Death
Star.\""; System.out.println(
input ); System.out.println(
StringUtils.replace( input, "\"", "\\\"" )
); System.out.println(
input.replaceAll( "\"", "\\\\\"" ) );
} }
----- Original Message -----
Sent: Wednesday, June 11, 2003 10:25
AM
Subject: Re: [cinjug-users] String
problem???
Hi folks,
Still ALL suggestions do not work. A little more
info : the input string is from a string database field that has " in it, and
not \". Thanks.
Ray
----------------
|