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

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
Who is Participating?
mgonulluConnect With a Mentor Commented:
oops no points??
Moderator what do you say

Try the Split function it should work
ppdocsAuthor Commented:
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) & " "
ppdocsAuthor Commented:
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..
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.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.