Determine if a string is numeric: Difference between revisions

Content deleted Content added
→‎[[mIRC]]: mIRC is the interpreter. MSL is the scripting language.
Line 55:
}
 
Alternative 1 : Check that each character in the string is number. Note that this will only works for integers.
 
 
private static final boolean isNumeric(final String s) {
Line 68 ⟶ 67:
}
 
Alternative 2 : use a regular expression ( a more elegant solution). Also, only for integers.
 
public static boolean IsNumeric(string inputData) {
final static Regex isNumber = new Regex(@"^-{0,1}\d+$");
Match m = isNumber.Match(inputData);
return m.Success;