Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

String manipulation

Posted on 2004-03-23
2
Medium Priority
?
264 Views
Last Modified: 2010-05-01
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
0
Comment
Question by:cakirfatih
[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 Comments
 
LVL 86

Expert Comment

by:Mike Tomlinson
ID: 10662731
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
0
 
LVL 5

Accepted Solution

by:
waelothman earned 200 total points
ID: 10662776
MyString=Split(Name,",")

FirstName= Trim(MyString(0))
LastName= Trim(MyString(1))
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

610 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