aspose file tools
The moose likes Java in General and the fly likes Append string to stringbuffer in same line Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Append string to stringbuffer in same line" Watch "Append string to stringbuffer in same line" New topic
Author

Append string to stringbuffer in same line

amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I have stringbuffer in which i append string thiesestring is of variable lengt
has different value .I want that when i append string to stringbuffer it append
to same line .I use append method of stringbuffer.But the whole value is not
in same line it breaks into many line all lines are not of same size.
Thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Not sure I follow what you are asking. Can you post the code that demonstrates your problem?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
hi,


I use append method of stringbuffer.But the whole value is not
in same line it breaks into many line all lines are not of same size.
Thanks[/QB]


it seems the strings you are appending are come with line feed character "\n".

please put your code here.

milan.


Milan.<br />I can because I think I can...
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
The code is

When i output it i get
<table border=1
bgcolor=#CCCCCC><tr>
Thanks
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
hi

i used the same . but it works properly.



the output is strait line with no line breaks.


milan.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

I would imagine that how it is rendered depends on what you are outputting it to. There is nothing in the String that asks for a line break. How are you writing this out?

(NB: since your text is HTML, do you really need to worry about line breaks? How it is rendered will be decided by the browser - white space shouldn't play any part in the eventual formatting?)
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I make ajax application i send the string as json object .Because of line break i am not able to parse it properly it gives error.My requirement is that all the data must be on same line.
Thanks
amit sharma
Ranch Hand

Joined: Jul 19, 2006
Posts: 129
I write the stringbuffer which i send to client in text file .In text file it
not show any line break but why there are arbitrary line break when i use it in client .
Thanks
Milan Jagatiya
Ranch Hand

Joined: Jan 01, 2007
Posts: 164
I think you should put all your files that are involve in this process.
milan.
 
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.
 
subject: Append string to stringbuffer in same line
 
Similar Threads
Line Feed Carriage Return problem
Are Objects passed by value or reference?
Guess the answer
HttpSessionAttributeListener Not Working
StringBuffer parameter passing.