I need to develop a code to check the String has got any Semicolon. And charector can be in any flavor.
Charector : ;
Ascii : 59
HTML Entity (decimal) : ;
HTML Entity (hex) : ;
Alt : 059
Alt : 59
UTF-8 (hex) : 0x3B (3b)
UTF-8 (binary) : 00111011
UTF-16 (hex) : 0x003B (003b)
UTF-16 (decimal) : 59
UTF-32 (hex) : 0x0000003B (3b)
UTF-32 (decimal) : 59
etc...
Is there a proper way with regular expression , where I can check all flavors of semicolon.
Strings don't have an encoding. So you need to just check on myString.contains(";")
What about
if(yourString.contains(";")){
// Do things
}
Why do you need a regex just to see if it contains one character ?
If you need to check for semicolon, all you need to do is:
int pos = yourString.indexOf(";");
if (pos != -1) {
//...semicolon found at position pos
}
What do you actually mean by "flavours of semicolon"?
User contributions licensed under CC BY-SA 3.0