This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I'm trying to generate a String that will be enclosed by quotes (") on each end but I want the quotes to be part of the string. Conceptually, I'm trying to do something like:
String str = ""This is a string"";
so that System.out.println(str) would produce the output: "This is a string" (quotes are printed).
I tried something like this:
Byte[] bytes = new Byte[1]; bytes[0] = 00100011; // I think this is the correct unicode for " String quote = new String(bytes); String str = new String(quote + "This is a string" + quote);
But I can't get this to compile. I keep getting an error saying that it can't find the symbol String(bytes[]). Maybe I'm not creating the byte array properly.
Thanks so much for the help. I read all through the String section of the Sun Java 2 Tutorial and didn't see anything about using \" for a quote. After your reply, I looked through it again and still don't see it mentioned there.
Thanks [ August 08, 2006: Message edited by: Paul Drallos ]
Originally posted by Paul Drallos: ...I read all through the String section of the Sun Java 2 Tutorial and didn't see anything about using \" for a quote...
Escape sequences (\+char) apply to characters, so the tutorial covers them under the characters section.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.