Advertisement
Guest User

Untitled

a guest
Feb 14th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. public static string[] Test(string s)
  2.         {
  3.             string tt = "";
  4.             List<string> subStr_ = new List<string>();
  5.             bool inQuotes = false;
  6.             for (int i = 0; i < s.Length; i++)
  7.             {
  8.                 if (s[i] == '"')
  9.                 {
  10.                     inQuotes = !inQuotes;
  11.                     continue;
  12.                 }
  13.                 if (s[i] != ';' || (s[i] == ';' && inQuotes)) tt += s[i];
  14.                 else
  15.                 {
  16.                     subStr_.Add(tt);
  17.                     tt = "";
  18.                 }
  19.             }
  20.             if (tt != "") subStr_.Add(tt);
  21.             return subStr_.ToArray();
  22.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement