Extract substring from a string until finds a comma c# asp.net


substring = str.Split(‘,’)[0];

or

You can use IndexOf() to find out where is the comma, and then extract the substring. If you are sure it will always have the comma you can skip the check.

or

or

Leave a Reply

Your email address will not be published. Required fields are marked *

*