split in web application

value ="Employee1, Boutros William Ton,Partner, Employee2, "
value .Split(New Char() {", "}, StringSplitOptions.RemoveEmptyEntries)
return  5 output instead 3 why???
pamela rizkDeveloperAsked:
Who is Participating?
 
pamela rizkConnect With a Mentor DeveloperAuthor Commented:
it is solved using  Dim lines() As String
        lines = Regex.Split(k, chars)
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
You are saying split on the following characters, and there are two different ones, split on a comma or split on an space ' '.
As I said in your earlier question to split on the string ", " you need to specify to the split function that it is a string, not a character, you want to split on.

value .Split(New String() {", "}, StringSplitOptions.RemoveEmptyEntries)
0
 
pamela rizkDeveloperAuthor Commented:
in my string value ="Employee1, Boutros William Ton,Partner, Employee2, "
values are separated by ", "
comma and space

how to split comma and space ina way to have 3 as outputtt????
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
pamela rizkDeveloperAuthor Commented:
event when doing value.split(", ") it is giving 5 outputsss??
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Did you do what I suggested.  It does work.
SNAG-0020.bmp
1
 
pamela rizkDeveloperAuthor Commented:
yes it is working so both solution are correct
0
 
pamela rizkDeveloperAuthor Commented:
Dim lines() As String
        lines = Regex.Split(k, chars)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.