Java String Replace and null characters

Posted by praspa on Stack Overflow See other posts from Stack Overflow or by praspa
Published on 2010-03-26T12:48:02Z Indexed on 2010/03/26 12:53 UTC
Read the original article Hit count: 288

Filed under:
|
|
|

Testing out someone elses code (of course it was ...) ,

I noticed a few JSP pages printing funky non-ascii characters. Taking a dip into the source I found this tidbit.

// remove any periods from first name e.g. Mr. John --> Mr John
firstName = firstName.trim().replace('.','\0');

Does replacing a character in a String with a null character even work in Java? I know that '\0' will terminate a c-string. Would this be the culprit to the funky characters?

Thanks PR

© Stack Overflow or respective owner

Related posts about java

Related posts about jsp