mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 11:13:31 +00:00
18 lines
440 B
Dart
18 lines
440 B
Dart
import 'package:intl/intl.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@?^=%&/~+#-])?"),
|
|
"");
|
|
}
|
|
|
|
final decimalWithCommasFormat = NumberFormat("#,##0.###");
|