fluffychat/lib/utils/beautify_string_extension.dart

16 lines
351 B
Dart
Raw Permalink Normal View History

2020-02-04 14:42:35 +01:00
extension BeautifyStringExtension on String {
String get beautified {
2020-05-13 15:58:59 +02:00
var beautifiedStr = '';
for (var i = 0; i < length; i++) {
beautifiedStr += substring(i, i + 1);
2020-02-04 14:42:35 +01:00
if (i % 4 == 3) {
2020-05-13 15:58:59 +02:00
beautifiedStr += ' ';
2020-02-04 14:42:35 +01:00
}
if (i % 16 == 15) {
2020-05-13 15:58:59 +02:00
beautifiedStr += '\n';
2020-02-04 14:42:35 +01:00
}
}
return beautifiedStr;
}
}