Solved

vb.net split

Posted on 2013-06-18
2
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

626 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