Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static List<string> stringToWordArray(string s)
- {
- List<string> words = new List<string>();
- string word;
- s = s.ToUpper();
- s = s.Trim(',', '.', '"', '-', ' ', ':', ';', '\n', '!', '?');
- while (s.Length > 0)
- {
- if (s.Contains(' '))
- {
- word = s.Substring(0, s.IndexOf(" "));
- s = s.Substring(s.IndexOf(" ") + 1);
- s = s.Trim();
- }
- else
- {
- word = s;
- s = "";
- }
- word = word.Trim(',', '.', '"', '-', ' ', ':', ';', '\n', '!', '?');
- if (word.Length > 0)
- words.Add(word);
- else
- return words;
- }
- return words;
- }
Advertisement
Add Comment
Please, Sign In to add comment