character selection in a string

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

Guest

I have the following type of data sitting in a varaible

Just Buttons+butto

The text and lenght can change, however, no matter what the length is I would like to strip off the "+" sign and everything to the right of it and place it into another (or the same) variable. What is the easiest way to accomplish this

Thank you
John
 
jcrouse said:
I have the following type of data sitting in a varaible:

Just Buttons+button

The text and lenght can change, however, no matter what the length is
I would like to strip off the "+" sign and everything to the right of
it and place it into another (or the same) variable. What is the
easiest way to accomplish this?

Dim s As String

s = "Just Buttons+button"

s = s.Split("+"c)(0)


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html
 
John,
In addition to Armin's suggestion:

Dim s As String

s = "Just Buttons+button"

s = s.SubString(0, s.IndexOf("+"c)

I suspect there are probably 2 or 3 other methods you could use ;-)

Hope this helps
Jay


jcrouse said:
I have the following type of data sitting in a varaible:

Just Buttons+button

The text and lenght can change, however, no matter what the length is I
would like to strip off the "+" sign and everything to the right of it and
place it into another (or the same) variable. What is the easiest way to
accomplish this?
 
HI Jay,
I suspect there are probably 2 or 3 other methods you could use ;-)

It was for me a challenge and I can give of course a VB left function,
however the one you gave is the best in my opinion and therefore I will not
bring the OP in problems by giving him another one.

:-)

No need answering.

Cor
 
Back
Top