Search
 
SCRIPT & CODE EXAMPLE
 

DART

flutter check if string is number

bool isNumeric(String s) {
 if (s == null) {
   return false;
 }
 return double.tryParse(s) != null;
}
Comment

check if string is number dart

//From coflutter.com

bool isNumericUsingRegularExpression(String string) {
  final numericRegex = 
    RegExp(r'^-?(([0-9]*)|(([0-9]*).([0-9]*)))$');

  return numericRegex.hasMatch(string);
}
Comment

check if string contain number dart flutter

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());
  }
}
Comment

PREVIOUS NEXT
Code Example
Dart :: Waiting for another flutter command to release the startup lock.. 
Dart :: flutter padding top and bottom 
Dart :: dart datetime parse 
Dart :: rounded borders for container in flutte 
Dart :: reverse srring in dart 
Dart :: Keyboard Pushes Text Fields off screen flutter 
Dart :: delete shared preference flutter 
Dart :: raised button deprecated flutter 
Dart :: undeline to text in flutter 
Dart :: regex numbers only dart 
Dart :: circular elevated button flutter 
Dart :: flutter snackbar color 
Dart :: into to char dart 
Dart :: how to use hexadecimal color in flutter 
Dart :: android application ic_launcher dimmensions 
Dart :: flutter compare dates 
Dart :: Send HTTP POST request in Flutter or Dart 
Dart :: flutter firestore update 
Dart :: Flutter how to use ListTile Threeline 
Dart :: convert object to int flutter 
Dart :: dart replase 
Dart :: sizedbox flutter 
Dart :: dart try catch 
Dart :: singleton in dart 
Dart :: release apk not working flutter 
Dart :: flutter future return error 
Dart :: dart while 
Dart :: get length of map flutter 
Dart :: flutter column in listview not working 
Dart :: text substring dart 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =