• Post Reply Bookmark Topic Watch Topic
  • New Topic

Append string to stringbuffer in same line  RSS feed

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure I follow what you are asking. Can you post the code that demonstrates your problem?
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
amit sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code is

When i output it i get
<table border=1
bgcolor=#CCCCCC><tr>
Thanks
 
Milan Jagatiya
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i used the same . but it works properly.



the output is strait line with no line breaks.


milan.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you should put all your files that are involve in this process.
milan.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!