This content has been marked as final. Show 4 replies
What part of the Javadoc for java.lang.String didn't you understand?
please help me i want to remove non char from string input by user.what non-characters you want to remove ?
Please show what you did so far.
Since the String class implements the CharSequence interface, everything in a string is a char. Thus, a string has no non "non-chars." Do you perhaps mean you want to remove non-printable characters? Non-ASCII characters? Something else?
In general, you can use String.replaceAll() with a regular expression as an argument on what you want to remove.
A search of Google for something like this:
string.replaceAll non printable
If it doesn't suite your needs, you can vary the Google search string to get what you want, or read up on regular expressions.