Solved

vb.net split

Posted on 2013-06-18
2
325 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 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

19 Experts available now in Live!

Get 1:1 Help Now