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!

How to erase null characters from string?

821184Dec 4 2010 — edited Dec 5 2010
Hello
I cast an array to a string with String(array). The array (type byte) contains ascii byte codes, but there are always some empty spots in the end of the array. When casted to a string, these emptys will show up as squares (null's?) when the string is printed. I want to split the string so I can get a clean string with only the first meaningfull characters. Can anyone help me on this? I have tried
replaceAll(null, ""); with no luck (the whole string is erased).

greetings from Henrik

Edited by: user13418034 on Dec 4, 2010 1:24 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 2 2011
Added on Dec 4 2010
7 comments
3,691 views