How to read the comma separated values from a string

Platform: ASP.NET| Category: Miscellaneous

VB.NET


Dim myString As String = 'A, B, C, D'
Dim delimStr As String = ' ,'
Dim delimiter As Char() = delimStr.ToCharArray()
Dim s As String
For Each s In myString.Split(delimiter)
	Response.Write((s.ToString() + '<br>'))
Next

C#


string myString = 'A, B, C, D';
string delimStr = ' ,';
char[] delimiter = delimStr.ToCharArray();
foreach (string s in myString.Split(delimiter))
{
	Response.Write (s.ToString ()+ '<br>');    
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.