Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing text from a string

Status
Not open for further replies.

alspoll

Technical User
Joined
Feb 4, 2006
Messages
6
Location
US
Hello all,

i have a string formatted as

a@b@c@d@e

how can i just have d@e or b@e?

TIA,

hope this makes sense.
AL
 
Say you have
Code:
rope = "a@b@c@d@e"
how can i just have d@e
Code:
backend = right(rope, 3)
Not sure what you're asking for here: is it letters

3, 4, 9
3, 6, 9
3, 8, 9

I'll just assume you mean 3, 6, 9
Code:
bits = ""
for i = 3 to len(rope) step 3
   bits = bits & mid(rope, i, 1)
next
 
Try out the the MID function. It works like this, the first parameter is the string you want to parse. The second is the start postion for "cutting", the third paramter is how many characters you want to "cut". So ...

mystr = MID("a@b@c@d@e",3,3)
Wscript.Echo mystr
mystr = MID("a@b@c@d@e",7,3)
Wscript.Echo mystr

Should return "b@c" and "d@e" respectively
 
try the split() function

aArray = Split(strX, "@")
If UBound(aArray) = 5 Then
Wscript.Echo aArray(0) & "@" & aArray(2)
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top