[Solved] How can I substring word in C#


A simple approach is using string.Split() to split the words by white-space, take two words via Enumerable.Take and then join them with white-spaces again:

string firstTwoWords = string.Join(" ", text.Split().Take(2));

Remember to add using System.Linq;

Demo

solved How can I substring word in C#