Answers for ".NET split string"

32

c sharp split string

// To split a string use 'Split()', you can choose where to split
string text = "Hello World!"
string[] textSplit = text.Split(" ");
// Output:
// ["Hello", "World!"]
Posted by: Guest on February-22-2020
11

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}>");
}
Posted by: Guest on March-24-2020
5

how to split a string with strings in c#

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);
}
Posted by: Guest on April-13-2020
-2

how to split a string by in c#

char[] separator = new[] { ',' };
var result = aiTranslatedString.Split(separator, StringSplitOptions.RemoveEmptyEntries).ToList();
Posted by: Guest on October-08-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language