Answers for "csharp split"

1

string.split c#

//splitting a string to a string[] (array)
string toSplit = "I Hope this will help YOU!";
string[] Splitted = toSplit.Split(' '); // ' ' NOT " "
  //this is beacuse "" indicates a string but not a character literal(its '')
//OUTPUTS: [I, Hope, this, will, help, YOU!]
Posted by: Guest on April-12-2021
-2

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}>");
}
Posted by: Guest on January-22-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language