• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 18
  • Last Modified:

split in web application

value ="Employee1, Boutros William Ton,Partner, Employee2, "
value .Split(New Char() {", "}, StringSplitOptions.RemoveEmptyEntries)
return  5 output instead 3 why???
0
pamela rizk
Asked:
pamela rizk
  • 5
  • 2
1 Solution
 
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
 
pamela rizkDeveloperAuthor Commented:
event when doing value.split(", ") it is giving 5 outputsss??
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
pamela rizkDeveloperAuthor Commented:
it is solved using  Dim lines() As String
        lines = Regex.Split(k, chars)
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 5
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now