Filtering of a string

Hi, I have a string
Eg. = 100

I just want the string container1, how can I filter this?
*note this container string might be from container1 till container100

I tried using str=right(..... But have a hard time figuring it out. Hope sone expert can help.

I'm using vb script
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

If your string is always in that format, an easy way would be:

strA = Left(FullString, InStrRev(FullString, ".") - 1)
strB = Left(strA, InStrRev(strA, ".") - 1)
ContainerStr = Mid(strB, InStrRev(strB, ".")  + 1)

You could fool around to use just one variable, but this is probably easier to see.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Can you explain it a little more because I can't follow completly. Are you're string always the same (with a changin name of the containernumber) ?

txt = " = 100"
pos = InStr(1, txt, "container")
txt = Right(txt, Len(txt) - (InStr(1, txt, "container")) + 1)
txt = Left(txt, InStr(1, txt, ".") - 1)

Open in new window

Bill PrewCommented:
Another way to do this is using the Split() function, which will break apart a string into array elements, using a delimiter you specify.  In this case you can break apart at the periods like this:

strTemp = " = 100"
strFields = Split(strTemp, ".")
Wscript.Echo strFields(3)

Open in new window

Just keep in mind that the resulting array is zero based, so the first elemnet will be strFields(0).

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.