Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java: Preserve empty string

 
Kajal Sharma
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a string like this in the xml file:

global.displayString =" Price" + " " ;

Initially using StringTokenizer to split the string. But now I want to preserve the white spaces which exists at the end of the string.

Please suggest.
 
Campbell Ritchie
Sheriff
Posts: 48402
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read the important administrative private message I have just sent you.

CR
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand the question. What exactly do you want to do, what code are you having now, and how is what it is doing different from what you want to have?
 
Kajal Sharma
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a xml file having string as:

global.displayString = "$" + global.price + " ";

In the present scenario while doing various processing in the file ?I am reading data from xml file using String Tokenizer
StringTokenizer attrtokens = new StringTokenizer(RHSStr," ");
taking space as a delimiter.

But now I want some way where I can keep a record of such strings where a long empty string has been added , to avoid any loss of such type of strings.

Hope this explains a little more.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic