string[] txt = text.Split(new char[] {'n'}); StringBuilder sbFull = new StringBuilder(); for (int index = 0; index < txt.Length; index++) { string st = txt[index]; int pos = 0; while ((pos < st.Length) && (st[pos] == ' ')) pos++; if (pos > 0) { for (int indexSp = 0; indexSp < pos; indexSp++) { sbFull.Append(" "); } sbFull.Append(st.Substring(pos)); } else { sbFull.Append(st); } if (index < txt.Length - 1) { sbFull.Append(""); } } return sbFull.ToString();
What do you think about this topic? Send feedback!
|
Copyright (c) 2017. All rights reserved.
|