Ventussapphire
0
Q:

how to split a string by in c#

var array = theString.Split(' ', 2);
1
string restOfArray = array[1];
1
listStrLineElements = line.Split(',').ToList();
5
string phrase = "The quick brown    fox     jumps over the lazy dog.";
string[] words = phrase.Split(' ');

foreach (var word in words)
{
    System.Console.WriteLine($"<{word}>");
}
5
string[] separatingStrings = { "<<", "..." };

string text = "one<<two......three<four";
System.Console.WriteLine($"Original text: '{text}'");

string[] words = text.Split(separatingStrings, System.StringSplitOptions.RemoveEmptyEntries);
System.Console.WriteLine($"{words.Length} substrings in text:");

foreach (var word in words)
{
    System.Console.WriteLine(word);
}
4
string[] tokens = str.Split(new[] { "is Marco and" }, StringSplitOptions.None);
0
char[] separator = new[] { ',' };
var result = aiTranslatedString.Split(separator, StringSplitOptions.RemoveEmptyEntries).ToList();
0
using System.Linq; // <----- Required for .ToList()

listStrLineElements = line.Split(',').ToList();
0

New to Communities?

Join the community