[Solved] How can I substring word in C#

[ad_1]

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

[ad_2]

solved How can I substring word in C#