[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

how do you take a char out of a string

Posted on 2004-08-20
14
Medium Priority
?
179 Views
Last Modified: 2010-05-02
how do i remove the @ from @hello in a string please


thanks ever so much

so "@hello" becomes "hello"

0
Comment
Question by:Johnny
  • 6
  • 6
  • 2
14 Comments
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856644
Hi again Pern

you could use code similar to this

str_Test = "@hello"

str_Test =replace(str_Test,"@","")

HTH

Scott
0
 
LVL 15

Accepted Solution

by:
Colosseo earned 2000 total points
ID: 11856658
or another example if it is always the first character you want to strip off you can use

str_Test = "@hello"

str_Test = mid(str_Test,2)

Regards

Scott
0
 
LVL 76

Expert Comment

by:David Lee
ID: 11856663
NewString = Replace("@hello", "@", "")
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 76

Expert Comment

by:David Lee
ID: 11856668
Colosseo types faster!
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856691
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 :)
0
 

Author Comment

by:Johnny
ID: 11856753
wlist.text="@hello"

WList.Text = Mid(WList.Text, 2)

i get a blank WList.Text when i try to do this anyhelp?
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856772
Hi pern what kind of object is wlist?
0
 

Author Comment

by:Johnny
ID: 11856775
a listbox
0
 

Author Comment

by:Johnny
ID: 11856800
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
0
 

Author Comment

by:Johnny
ID: 11856803
side note is there a way to update the listbox esaly with out repopulating it with the take out @?
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856853
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
0
 

Author Comment

by:Johnny
ID: 11856883
it would have to match the one we striped and leave the rest as is
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856897
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

0
 

Author Comment

by:Johnny
ID: 11856920
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

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses
Course of the Month17 days, 18 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question