breakByLength method
将字符串按长度拆分
Implementation
List<String> breakByLength(int limitLength) {
final result = <String>[];
if (this?.isNotEmpty == true) {
final length = this?.length ?? 0;
int start = 0;
int end = min(length, limitLength);
while (true) {
String str = this!.substring(start, end);
result.add(str);
start = end;
end = min(length, end + limitLength);
if (start == end) {
break;
}
}
}
return result;
}