I need to write a function that will return me the part after the first word (first whitespace).
For example I have got below string in C# 2.0.
string str = "M000. New Delhi"
Now I want to write a function which return “New Delhi” if str is passed.
Please suggest!!
To get the part of the string after the first space:
This will also give a result even if there happens to be no space in the string. The
IndexOfmethod will return-1in that case, so the code will return the entire string. If you would want an empty string or an exception in that case, then you would get the index into a variable first so that you can check the value: