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

Splitting a string with one substring as the first word up until a space, and the rest of the string (spaces included) as the second substring

Posted on 2008-09-30
5
272 Views
Last Modified: 2012-05-05
I have a string with a long name in it.

Example: Paul De La Cruz

I need to split it into first and last names, where first name is the string up until the first space. Last name will be anything that isn't the first name.

str1= Paul
str2 = De La Cruz
0
Comment
Question by:ppdocs
  • 3
  • 2
5 Comments
 
LVL 9

Expert Comment

by:mgonullu
ID: 22608612
http://www.bellaonline.com/articles/art18819.asp

Try the Split function it should work
0
 

Author Comment

by:ppdocs
ID: 22608895
This ended up working, thanks though...

 Dim tmpstr As String = excelvalue
        Dim strlines As String()
        If Len(tmpstr) <> 0 Then
          strlines = tmpstr.Split(" ")
          Dim FirstName As String
          Dim LastName As String = ""

          FirstName = strlines(0)

          For i As Integer = 1 To strlines.Length - 1
            LastName = LastName & strlines(i) & " "
          Next
0
 
LVL 9

Accepted Solution

by:
mgonullu earned 500 total points
ID: 22609326
oops no points??
Moderator what do you say
0
 

Author Closing Comment

by:ppdocs
ID: 31501683
I don't think that copying and pasting a site that I already looked at as being all that helpful, but if the points are that important to you, here you go..
0
 
LVL 9

Expert Comment

by:mgonullu
ID: 22609413
Thank you, points are not important for me, I didn't know that you already looked to my website, I am here to assist only. Thank you again.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Forcing form refresh - classic ASP 7 72
Select2 jquery help 9 94
JQuery to parse xml string and get element by id 4 47
Hide Table in merge 3 30
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 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