Split string

CSharp · Console

/Program.cs

using System;
					
public class Program
{
	public static void Main()
	{
		string input = "Hello, my name is Boris, then sun is sunshine the weather is good and I forgot my workbook.";
		string [] parts = input.Split(' ');
		string result = "";
		
		for(int idx = 0; idx < parts.Length; idx++){
			result += parts[idx];
			if(result.Length >= 10)
				break;
			
			result += " ";
		}
		
		Console.WriteLine(result);
	}
}
;