fluffychat/lib/utils/beautify_string_extension.dart

16 lines
364 B
Dart
Raw Permalink Normal View History

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