Trim function

M

Michael

Any ideas on how to trim a variable length string such as
123^456^789
The result in this case I need would be 789. However the
length of the string is never constant.
Thanks for your insight!
 
G

Guest

I'm assuming that the "^" is a delimiter. that is you
want everything after the last "^"...
From what I've seen there is no one command. You may have
to loop through the string (Str) using the InStr function
to find the position of the last occurence of the "^"
(Pos.) Then do a Right(Str, len(Str) - Pos + 1)

Don
 
D

Dirk Goldgar

Michael said:
Any ideas on how to trim a variable length string such as
123^456^789
The result in this case I need would be 789. However the
length of the string is never constant.
Thanks for your insight!

Dim strSource As String
Dim strWanted As String

strSource = "123^456^789"

strWanted = Split(strSource, "^")(2)
 

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

Top