Advertisement
AvengersAssemble

ReversedSubStringsEx24

Feb 13th, 2014
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1.         public static string ReverseSubString(string st)
  2.         {
  3.             string subSt;
  4.             int i = 0, nextI;
  5.             while (i < st.Length)
  6.             {
  7.                 nextI = st.IndexOf('0', i);
  8.                 subSt = st.Substring(i, nextI - i);
  9.                 st = st.Replace(subSt, ReverseString(subSt));
  10.                 i = nextI + 1;
  11.             }
  12.             return st;
  13.         }
  14.         public static string ReverseString(string st)
  15.         {
  16.             string newSt = "";
  17.             for (int i = st.Length - 1; i > -1; i--)
  18.                 newSt += st[i];
  19.             return newSt;
  20.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement