public virtual List <string> Show(int width) { Content = FormattingText.DeleteSpace(Content); if (Content.Length <= width) { _formatText.Add(FormattingText.EndSpace(Content, width)); } else { return(FormatStr(Content, width)); } return(_formatText); }
public override List <string> Show(int width) { TitleTx = FormattingText.DeleteSpace(TitleTx); string edit = " "; TitleTx = edit + TitleTx.ToUpper(); if (TitleTx.Length <= width) { _formatText.Add(FormattingText.EndSpace(TitleTx, width)); } else { _formatText = FormatStr(TitleTx, width); } return(_formatText); }
public void FormatStr(string strIn, int width, ref List <string> list) { string strOut = ""; int i = 0; string space; while (i < strIn.Length) { int count = 0; if (list.Count == 0) { space = " "; } else { space = " "; } while (count < width - space.Length && i < strIn.Length) { strOut += strIn[i]; i++; count++; } i--; if (strOut[strOut.Length - 1].ToString() == " " || i == strIn.Length - 1) { strOut = FormattingText.DeleteSpace(strOut); list.Add(FormattingText.EndSpace(space + strOut, width)); } else { strOut = FormattingText.DeleteSpace(strOut); int tempt = strOut.Length - 1; count = 0; while (strOut[tempt] != ' ') { tempt--; count++; } list.Add(FormattingText.EndSpace(space + SomeNeedOverWrite.CopyStrToStr(strOut, 0, tempt), width)); i -= count; } i++; } }
public virtual List <string> FormatStr(string strIn, int width) { int i = 0; while (i < strIn.Length) { int count = 0; string strOut = ""; while (count < width && i < strIn.Length) { strOut += strIn[i]; i++; count++; } i--; if (strOut[strOut.Length - 1].ToString() == " " | i == strIn.Length - 1 /*| strIn[i + 1].ToString() == " "*/) { strOut = FormattingText.DeleteSpace(strOut); _formatText.Add(FormattingText.EndSpace(strOut, width)); } else { strOut = FormattingText.DeleteSpace(strOut); int tempt = strOut.Length - 1; count = 0; while (strOut[tempt] != ' ') { tempt--; count++; } _formatText.Add(FormattingText.EndSpace(SomeNeedOverWrite.CopyStrToStr(strOut, 0, tempt), width)); i -= count; } i++; } return(_formatText); }