splitStringToParagraphs function
- @Deprecated('Please use BidiString.fromLogical')
- String logicalString
Split the text into separate paragraphs.
A paragraph separator is kept with the previous paragraph. Within each paragraph, apply all the other rules of this algorithm.
3.3.1.P1.
Implementation
@Deprecated('Please use BidiString.fromLogical')
List<Paragraph> splitStringToParagraphs(String logicalString) {
final paragraphs = <Paragraph>[];
final codeUnits = logicalString.codeUnits;
var text = <int>[];
for (var i = 0; i < codeUnits.length; ++i) {
final char = codeUnits[i];
final type = getCharacterType(char);
if (type == CharacterType.separator) {
final paragraph = Paragraph._(text, char);
paragraphs.add(paragraph);
text = [];
} else {
text.add(char);
}
}
if (text.isNotEmpty) // string ended without a paragraph separator
{
paragraphs.add(Paragraph._(text, _BidiChars.notAChar));
}
return paragraphs;
}