14 lines
No EOL
296 B
Dart
14 lines
No EOL
296 B
Dart
extension NumberPrefix on String {
|
|
String get numberPrefix {
|
|
final sb = StringBuffer();
|
|
for (final c in this.runes) {
|
|
if ('0'.runes.first <= c && c <= '9'.runes.first) {
|
|
sb.writeCharCode(c);
|
|
}
|
|
else {
|
|
break;
|
|
}
|
|
}
|
|
return sb.toString();
|
|
}
|
|
} |