i'm trying to check how many non-alphanumeric characters can be found on a string for example:
String message = "i'm a keyboard!!!"
i want to check how many "!" and " ' " can be found on that string, not only those, but any symbol.
i'm trying to check how many non-alphanumeric characters can be found on a string for example:
String message = "i'm a keyboard!!!"
i want to check how many "!" and " ' " can be found on that string, not only those, but any symbol.
Regular expressions would be good for this. Try just replacing alphanumeric character with nothing and taking the length.
pattern = "[a-zA-Z0-9]*"
newString = message.replaceAll(pattern, "")
return newString.length