Solved

how do you take a char out of a string

Posted on 2004-08-20
14
167 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
Comment Utility
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 500 total points
Comment Utility
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
Comment Utility
NewString = Replace("@hello", "@", "")
0
 
LVL 76

Expert Comment

by:David Lee
Comment Utility
Colosseo types faster!
0
 
LVL 15

Expert Comment

by:Colosseo
Comment Utility
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
Comment Utility
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
Comment Utility
Hi pern what kind of object is wlist?
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:Johnny
Comment Utility
a listbox
0
 

Author Comment

by:Johnny
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
it would have to match the one we striped and leave the rest as is
0
 
LVL 15

Expert Comment

by:Colosseo
Comment Utility
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
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now