Flutter vérifier si la chaîne est le numéro
bool isNumeric(String s) {
if (s == null) {
return false;
}
return double.tryParse(s) != null;
}
MeVyom
bool isNumeric(String s) {
if (s == null) {
return false;
}
return double.tryParse(s) != null;
}
void main() {
var stringArr = ["Hello world", "Hello1 World", "H23llo", "H00Elo", "World"];
for (var i = 0; i < stringArr.length; i++) {
bool found = stringArr[i].contains(new RegExp(r'[0-9]'));
print(stringArr[i] + " -> " + found.toString());
}
}