Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Java and scala judge whether a string can be converted into numbers.
Java and scala judge whether a string can be converted into numbers.
It is troublesome to write a regular expression that matches various counting methods. The simplest integer matching regular expression is defined by regex (s: string) = {valpattern = ""(\ d+) $ "". r s match { case pattern(_ *)= > true case _ = >false } } isIntByRegex(" 123 ")isIntByRege ...