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
Solved

vb.net split

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

808 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