File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Java: Preserve empty string Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Java: Preserve empty string" Watch "Java: Preserve empty string" New topic

Java: Preserve empty string

Kajal Sharma

Joined: Sep 19, 2008
Posts: 11

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

Joined: Oct 13, 2005
Posts: 46332
Please read the important administrative private message I have just sent you.

Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
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?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Kajal Sharma

Joined: Sep 19, 2008
Posts: 11
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.
I agree. Here's the link:
subject: Java: Preserve empty string
It's not a secret anymore!