Regular Expression for semicolon

-2

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)        : &#59
            HTML Entity (hex)            : &#x3b
            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.
java
regex
asked on Stack Overflow Jul 9, 2014 by Kumar • edited Jul 9, 2014 by Kumar

3 Answers

1

Strings don't have an encoding. So you need to just check on myString.contains(";")

answered on Stack Overflow Jul 9, 2014 by Ivo Beckers
0

What about

if(yourString.contains(";")){
    // Do things
}

Why do you need a regex just to see if it contains one character ?

answered on Stack Overflow Jul 9, 2014 by singe3
0

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"?

answered on Stack Overflow Jul 9, 2014 by tomorrow

User contributions licensed under CC BY-SA 3.0