/// <summary> /// Splits the text on words using rules of the specified box /// </summary> /// <param name="text"></param> /// <returns></returns> public void SplitWords() { if (string.IsNullOrEmpty(Text)) { return; } _curword = new CssBoxWord(Box); bool onspace = IsSpace(Text[0]); for (int i = 0; i < Text.Length; i++) { if (IsSpace(Text[i])) { if (!onspace) { CutWord(); } if (IsLineBreak(Text[i])) { _curword.AppendChar('\n'); CutWord(); } else if (IsTab(Text[i])) { _curword.AppendChar('\t'); CutWord(); } else { _curword.AppendChar(' '); } onspace = true; } else { if (onspace) { CutWord(); } _curword.AppendChar(Text[i]); onspace = false; } } CutWord(); }
/// <summary> /// Splits the text on words using rules of the specified box /// </summary> /// <param name="text"></param> /// <returns></returns> public void SplitWords() { if (string.IsNullOrEmpty(Text)) return; _curword = new CssBoxWord(Box); bool onspace = IsSpace(Text[0]); for (int i = 0; i < Text.Length; i++) { if (IsSpace(Text[i])) { if (!onspace) CutWord(); if (IsLineBreak(Text[i])) { _curword.AppendChar('\n'); CutWord(); } else if (IsTab(Text[i])) { _curword.AppendChar('\t'); CutWord(); } else { _curword.AppendChar(' '); } onspace = true; } else { if (onspace) CutWord(); _curword.AppendChar(Text[i]); onspace = false; } } CutWord(); }