Link to home
Start Free TrialLog in
Avatar of cakirfatih
cakirfatih

asked on

String manipulation

hello yall ,
This is really easy.
I have a string that looks like this "ABCDEFG.., ZYPYOYO"
Basically "LastNames" "Comma" "FirstNames" and I would like to seperate the two.
Please provide me with a Function in Visual Basic that can do that.
Thanks in Advance
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

There are many ways to do this.  Here is one:

Private Sub Form_Load()
    Dim name As String
    Dim LastName As String
    Dim FirstName As String

    name = "ABCDEFG.., ZYPYOYO"
    LastName = Trim(Left(name, InStr(name, ",") - 1))
    FirstName = Trim(Mid(name, InStr(name, ",") + 1))
   
    Debug.Print name
    Debug.Print LastName
    Debug.Print FirstName
End Sub
ASKER CERTIFIED SOLUTION
Avatar of waelothman
waelothman

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial