Left Split

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a function that allows you to do a left split, or equivalent, on
data up to a space rather than upto a specified number of characters?

ie A234 BFG, the space can be in different positions so specifying the
number of characters wouldn't work.

Any ideas would be appreciated.

Alan
 
What you're is the "Split" function. It parses a string based on the
delimiter you specify, and returns an zero-based array of strings.

'==========================
Public Function UseSplit()

Dim arrParsedString() As String

arrParsedString = Split("A234 BFG", " ")

MsgBox arrParsedString(0) 'Show a message box with the message "A234"
MsgBox arrParsedString(1)'Show a message box with the message "BFG"

End Function
'==========================

Hope that helps!

DBS (David Staas)
 
? Left$("A234 BFG",InStr(1,"A234 BFG", " ")-1)
A234

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top