
@Kasani007 Sir, a little addition to what Sheo Sir has already presented,
Way 1: Using Split function of System.String class "rama,chandra;kumar"
.Split(new Char[] { ',', ';' },StringSplitOptions.RemoveEmptyEntries)
.ToList()
.ForEach(i => Console.WriteLine(i));
Way 2: Using Split function of System.Text.RegularExpressions.Regex class Regex
.Split("rama,chandra;kumar", @"[,;]+")
.ToList()
.ForEach(i => Console.WriteLine(i));
Way 3: Replace and split new Regex("[,;]")
.Replace("rama,chandra;kumar", ",") //replacing with comma
.Split(',') //split with comma
.ToList()
.ForEach(i => Console.WriteLine(i));
In all the above cases, the output will be
rama
chandra
kumar
Hope the answers presented here will help you.
--
Thanks & Regards,
RNA Team
Kasani007, if this helps please login to Mark As Answer. | Alert Moderator