Johnny
asked on
how do you take a char out of a string
how do i remove the @ from @hello in a string please
thanks ever so much
so "@hello" becomes "hello"
thanks ever so much
so "@hello" becomes "hello"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
NewString = Replace("@hello", "@", "")
Colosseo types faster!
and if @hello is in a string of other words...
str_Test = "other words @hello around hello"
str_Test =replace(str_Test,"@hello" ,"hello")
Scott
- BlueDevilFan -- Colosseo has nothing better to do :)
str_Test = "other words @hello around hello"
str_Test =replace(str_Test,"@hello"
Scott
- BlueDevilFan -- Colosseo has nothing better to do :)
ASKER
wlist.text="@hello"
WList.Text = Mid(WList.Text, 2)
i get a blank WList.Text when i try to do this anyhelp?
WList.Text = Mid(WList.Text, 2)
i get a blank WList.Text when i try to do this anyhelp?
Hi pern what kind of object is wlist?
ASKER
a listbox
ASKER
hahaha that did it i just didnt make it save itsself
NewString= Mid(WList.Text, 2)
and that works perfectly
thanks alot heres your points again
NewString= Mid(WList.Text, 2)
and that works perfectly
thanks alot heres your points again
ASKER
side note is there a way to update the listbox esaly with out repopulating it with the take out @?
Hi pern glad its working :)
You could try code like this to loop through all items in the listbox
if the item starts with an @ then the @ is stripped off
For i = 0 To WList.ListCount - 1
If Left(WList.List(i), 1) = "@" Then WList.List(i) = Mid(WList.List(i), 2)
Next
Hope that works for you mate
Thanks for the grade
Scott
You could try code like this to loop through all items in the listbox
if the item starts with an @ then the @ is stripped off
For i = 0 To WList.ListCount - 1
If Left(WList.List(i), 1) = "@" Then WList.List(i) = Mid(WList.List(i), 2)
Next
Hope that works for you mate
Thanks for the grade
Scott
ASKER
it would have to match the one we striped and leave the rest as is
well using the code above
@hello
hello
test
@test
would return
hello
hello
test
test
but it could be changed to only affect @hello
so for it to return
hello
hello
test
@test
For i = 0 To WList.ListCount - 1
If WList.List(i) = "@hello" Then WList.List(i) = Mid(WList.List(i), 2)
Next
Hope thats what you meant
Cheers
Scott
@hello
hello
test
@test
would return
hello
hello
test
test
but it could be changed to only affect @hello
so for it to return
hello
hello
test
@test
For i = 0 To WList.ListCount - 1
If WList.List(i) = "@hello" Then WList.List(i) = Mid(WList.List(i), 2)
Next
Hope thats what you meant
Cheers
Scott
ASKER
thats right listboxes are sorta like arrays im stupid i should known that..guess im code burnt...rain always makes me tired and its pouring here
i also made the code change just the var i wanted and sent it via the newstring worked great
yes thats what i wanted thanks alot
i also made the code change just the var i wanted and sent it via the newstring worked great
yes thats what i wanted thanks alot
you could use code similar to this
str_Test = "@hello"
str_Test =replace(str_Test,"@","")
HTH
Scott