Trim function

  • Thread starter Thread starter Michael
  • Start date Start date
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!
 
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
 
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)
 
Back
Top