how to get first word of string in c#
string s = 'Solo learn'; Substring(0,s.IndexOf(' ')) If the words are separated by spaces.
String. Example: string s = "SoloLearn"; s gets 'S'.
word not character
Trim the sentence to eliminate whitespaces by using string::Trim method. Split the sentence into string array by using string::Trim method. Print the first element of the array. Use the subscript operator to refer the element by index. Remember that first element has index of zero. P.S. Tag C# rather than 'SoloLearn'.
Use String.Split() can split the string. Example: string s = "Solo Learn"; string arr = s.Split(); arr is "Solo".
thank you very much
regex probably work..probably there are other better method though