Link to home
Start Free TrialLog in
Avatar of no158
no158

asked on

String ref

Not sure what is going wrong with this but I need some help figuring this out.

I have a String str = n.getNodeValue();
If I do a System.out.println(str) the program will display the information but with whitespaces and newlines
Which leads me to belive that .trim() would be the best option for this kind of thing.
The problem is, when I edit the str in any manor I get a error on that same line the edit took place.
Any idea why this might happen and or a fix for this problem?


code:
String str = n.getNodeValue();
System.out.println(str.trim());   <-----Error here (when edit takes place to str)
//System.out.pritln(str); <-------------This code would work (format looks bad)
Avatar of Sys_Prog
Sys_Prog
Flag of India image

Hi no158,
What is the error that you get

Cheers!
Avatar of no158
no158

ASKER

NullPointerException
ASKER CERTIFIED SOLUTION
Avatar of avinthm
avinthm

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial