mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-19 16:23:37 +00:00
14 lines
349 B
Dart
14 lines
349 B
Dart
extension StringUtils on String {
|
|
String truncate({int length = 32}) {
|
|
if (this.length <= length) {
|
|
return this;
|
|
}
|
|
|
|
return '${substring(0, length)}...';
|
|
}
|
|
|
|
String stripHyperlinks() =>
|
|
replaceAll(RegExp(
|
|
r"(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?"),
|
|
"");
|
|
}
|