How to split a string in C#

Posted by Sheonarayan under C# category on | Points: 40 | Views : 1266
To split a string delimited by a string, we can use below code snippet.

string[] questions = MyQuestions.Split(new string[] { "[Q]" }, StringSplitOptions.RemoveEmptyEntries);

No need to user Regex or other methods.

This returns array, now you can loop through the array and get the split string
foreach (string q in questions)


Comments or Responses

Login to post response