Solved

vb.net split

Posted on 2013-06-18
2
332 Views
Last Modified: 2013-06-18
Hello Experts
I am trying to split the customer name into 3 parts to capture title,first and last name separately..

.Name = Node.SelectNodes("DELIVERTO/NAME").Item(0).InnerText

ex: "MRS HELLEN MICHAEL MURRAY"

I want to store the first 2 parts in 2 variables and the rest of the name in 3rd variable

Title = "MRS"
Fname="HELLEN"
Lname= "MICHAEL MURRAY"  


Please can someone advise?

Thanks
0
Comment
Question by:arthur112
  • 2
2 Comments
 
LVL 18

Assisted Solution

by:Cluskitt
Cluskitt earned 500 total points
ID: 39257016
Dim str As String()
Dim sName, Title, Fname, Lname As String
sName = .Name
str = sName.Split(" ")
Title = str(0)
Fname = str(1)
Lname = ""
For a = 2 To str.Length - 1
    Lname = Lname & " "
Next
Lname = Left(Lname, Len(Lname) - 1)

Open in new window

This should work, off the top of my head.
0
 
LVL 18

Accepted Solution

by:
Cluskitt earned 500 total points
ID: 39257020
Probably simpler:
Dim str As String()
Dim sName, Title, Fname, Lname As String
sName = .Name
str = sName.Split(" ")
Title = str(0)
Fname = str(1)
Lname = Replace(sName, Title & " " & Fname & " ", "")

Open in new window

0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Populating an array of locale_time_info 8 46
Vb. Net application freezes 9 45
VB: Convert 2 dates to specific format 24 48
VB.net and sql server 4 33
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

813 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now