Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Can't convert from String to Long.

807603Sep 9 2007 — edited Nov 27 2007
Hi,

I want to convert a String to Long type but i am getting NumberFormatException while converting.
My code is:

Long ln1 = new Long(ln.trim());

where ln is a String.
I tried several ways like first convertig String to long and then Long but then it throws same exception ans the ln1 value gets set to null.

The String seems to be perfect with no spaces etc at the end. Can anybody help me with this. This is quite urgent.

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 25 2007
Added on Sep 9 2007
13 comments
1,861 views