Skip to content

Instantly share code, notes, and snippets.

@fabads
fabads / main.dart
Last active May 1, 2020 07:47
This quick and dirty code evaluates the code performance to convert strings with leading zeros to strings without leading zeros. 2 methods are used: double conversion String to int then int to String and regular expressions
void main() {
// Returns empty string
String s00 = '00';
String s0 = s00.replaceAll(new RegExp(r'^[0]*'), '');
print("convesion of 00 with RegExp returns empty string: '$s0'");
String s01 = '01';
String s02 = '02';