Hi guys I have a problem at hand that I can’t seem to figure out, I have a string (C#) which looks like this:
string tags = "cars, motor, wheels, parts, windshield";
I need to break this string at every comma and get each word assign to a new string by itself like:
string individual_tag = "car";
I know I have to do some kind of loop here but I’m not really sure how to approach this, any help will be really appreciate it.
You can use one of String.Split methods
let’s try second option:
I’m giving
,and space as split chars then on each those character occurrence input string will be split, but there can be empty strings in the results. we can remove them usingStringSplitOptions.RemoveEmptyEntriesparameter.OR
you can access each tag by: