string data = "THExxQUICKxxBROWNxxFOX";
return data.Split(new string[] { "xx" }, StringSplitOptions.None);
- A string array should be passed as first parameter.
- In second parameter we can specify whether the substrings include empty array elements. etc
In this example string "xx" is passed but multiple string values can be passed as we want
string value = "The handsome, energetic, young dog was playing with his smaller, more lethargic litter mate.";
string[] separators = {",", ".", "!", "?", ";", ":", " "};
string[] words = value.Split(separators, StringSplitOptions.RemoveEmptyEntries);
foreach (var word in words)
Console.WriteLine(word);
more details can be found here.
No comments:
Post a Comment