This commit is contained in:
lollipopkit
2023-12-20 11:34:18 +08:00
parent eec13678a1
commit 6924290626
20 changed files with 104 additions and 105 deletions

View File

@@ -15,4 +15,18 @@ extension StringX on String {
}
Uint8List get uint8List => Uint8List.fromList(utf8.encode(this));
/// Upper the first letter.
String get upperFirst {
if (isEmpty) {
return this;
}
final runes = codeUnits;
if (runes[0] >= 97 && runes[0] <= 122) {
final origin = String.fromCharCode(runes[0]);
final upper = origin.toUpperCase();
return replaceFirst(origin, upper);
}
return this;
}
}