c# split int code example
Example 1: string.split c#
string toSplit = "I Hope this will help YOU!";
string[] Splitted = toSplit.Split(' ');
Example 2: split string in c#
string phrase = "The quick brown fox jumps over the lazy dog.";
string[] words = phrase.Split(' ');
foreach (var word in words)
{
System.Console.WriteLine($"<{word}>");
}
Example 3: split using string c#
data.Split(new string[] { "xx" }, StringSplitOptions.None);
Example 4: c# split string
string sentence = "Hello Beautiful World";
string[] words = sentence.Split(' ');
foreach (string word in words) {
print(word);
}
Example 5: string split c#
char[] delimiterChars = { ' ', ',', '.', ':', '\t' };
string text = "one\ttwo three:four,five six seven";
System.Console.WriteLine($"Original text: '{text}'");
string[] words = text.Split(delimiterChars);
System.Console.WriteLine($"{words.Length} words in text:");
foreach (var word in words)
{
System.Console.WriteLine($"<{word}>");
}