Answers for "split in csharp"

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
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

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language