Re: StringBuffer problems in GWT

2010-01-09 Thread Sorinel C
Why not using StringBuilder (faster, not thread-safe) instead of
StringBuffer (slower, thread-safe) ?

Cheers!
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: StringBuffer problems in GWT

2010-01-08 Thread rjcarr
What is the context?  What does this have to do with GWT?  Where is
the println directed to?

If this is somehow making its way onto a web page, then you need to
replace \n with  and put it inside of an HTML widget.

On Jan 6, 11:46 am, Brittany  wrote:
> The simplest way to explain my problem is to show you an example.
>
> CODE USING String:
> String str = "Two";
> str += "\n";
> str += "lines";
> System.out.println(str);
>
> OUTPUT:
> Two
> lines
>
> CODE USING StringBuffer:
> StringBuffer sb = new StringBuffer();
> sb.append("Two");
> sb.append("\n");
> sb.append("lines");
> System.out.println(sb.toString());
>
> OUTPUT:
> Two\nlines
>
> I've tried everything to try to get it to recognize the \n's, but
> nothing works. It won't recognize anything that came from StringBuffer
> as an escape character.  It reads them all literally. \r, \t, and even
> html tags.
>
> Is this a bug or is there something I'm missing?
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




StringBuffer problems in GWT

2010-01-08 Thread Brittany
The simplest way to explain my problem is to show you an example.

CODE USING String:
String str = "Two";
str += "\n";
str += "lines";
System.out.println(str);

OUTPUT:
Two
lines


CODE USING StringBuffer:
StringBuffer sb = new StringBuffer();
sb.append("Two");
sb.append("\n");
sb.append("lines");
System.out.println(sb.toString());

OUTPUT:
Two\nlines

I've tried everything to try to get it to recognize the \n's, but
nothing works. It won't recognize anything that came from StringBuffer
as an escape character.  It reads them all literally. \r, \t, and even
html tags.

Is this a bug or is there something I'm missing?
-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.