numericOnly static method
Extract numeric value of string 提取字符串的数值 Example: OTP 12312 27/04/2020 => 1231227042020ß If firstword only is true, then the example return is "12312" (first found numeric word)
Implementation
static String numericOnly(String s, {bool firstWordOnly = false}) {
String numericOnlyStr = '';
for (var i = 0; i < s.length; i++) {
if (ValidatorUtils.isNumericOnly(s[i])) numericOnlyStr += s[i];
if (firstWordOnly && numericOnlyStr.isNotEmpty && s[i] == " ") break;
}
return numericOnlyStr;
}