Solved

split in web application

Posted on 2016-09-02
3
29 Views
Last Modified: 2016-09-02
I he the below string

dim k as string="Employee1, Boutros William Ton,Partner, Employee2, "

i am splitting this string as below :
  Dim NameValue As String =k
        Dim Nameelements() As String = NameValue.Split(New Char() {",  "}, StringSplitOptions.RemoveEmptyEntries)

but the output is not correct

i need the output to be an array with 3 columns :
Employee1
Boutros William Ton,Partner
Employee2

how to do that
0
Comment
Question by:pamela rizk
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 41781178
use
.Split(New String() {", "}, StringSplitOptions.RemoveEmptyEntries)

using the string not char (chars are only one char long, hence your problem) and note there is only one space after the "," not two as in your original attempt.
0
 

Author Closing Comment

by:pamela rizk
ID: 41781183
tnx
0
 

Author Comment

by:pamela rizk
ID: 41781184
but there is another rprobelm
value ="Employee1, Boutros William Ton,Partner, Employee2, "
value .Split(New Char() {", "}, StringSplitOptions.RemoveEmptyEntries)
return  5 soutput instead 3 why???
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question