Last active
December 13, 2019 15:59
-
-
Save LiewJunTung/a1b37d34dca6240fd13d58d8e93b1ca2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension NumberParsing on String { | |
int parseInt() { | |
return int.parse(this); | |
} | |
double parseDouble() { | |
return double.parse(this); | |
} | |
} | |
void main(){ | |
var numString = "100"; | |
var numInt = numString.parseInt(); | |
print(numInt is int); | |
var numDouble = numString.parseInt(); | |
print(numDouble is double); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment