java - Allow string contains specific char from string -
i want check string
if contains specific char
string
.
how can in java
?
thank you.
example:
string inputstring =hi, how you?"; string allowchar ="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz,.?!0123456789 ";
use : inputstring.matches("["+allowchar+"]+")
check if inputstring
contains characters mentioned in allowchar
tring
Comments
Post a Comment