anndy smaals

anndy smaals

  • NA
  • 24
  • 4.3k

splitting string into array of strings

Dec 14 2018 2:04 PM
Below i want to split the string and find the longest word
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp15
{
class Program
{
static void Main(string[] args)
{
string lyric = "We've come a long long way together";
string[] words;
string longestWord;

words = lyric.Split(' ');
longestWord = lyric;


Console.WriteLine("There are " + words.Length + " words, and the longest is " + longestWord);
Console.ReadLine();
}
}
}

Answers (3)