simple edit string question

i have a variable....

Testies = '99876'

i need to simply get rid of the ' and just have 99876

what is the easiest way to do this???
ThermosAsked:
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.

Mike TomlinsonMiddle School Assistant TeacherCommented:
If your asking how to convert a string to a number then:

Private Sub Form_Load()
    Dim Testies As String
    Testies = "99876"
   
    Dim Balls As Double
    Balls = CDbl(Testies)
   
    Dim Nads As Long
    Nads = CLng(Testies)
   
    Dim Nuts As Single
    Nuts = CSng(Testies)
   
    MsgBox Testies & " < " & (Balls * Nads * Nuts)
End Sub

Idle_Mind
0
bingieCommented:
lol!
0
Arthur_WoodCommented:
when you say you want to get rid of the ' and only have 99876, do you mean you have a STRING value, and you want to convert it to a NUMBER?

How do you ge the value as Testies = '99876'  ?  since the ' character acts as a Comment

What exactly are you trying to accomplish, as your explanation is VERY confused.

AW
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

bad_seedCommented:
if the ' character is only at the beginning and end of the string then the code below will do the trick

    Dim test As String
    Dim test2 As String

    test = "'123456'"
   
    test2 = Mid(test, 2, (Len(test) - 2))
----------------------------------------------------------------

However if the ' can be anywhere in the string then try this

    Dim test As String
    Dim test2 As String

    test = "'1'23'456'"
   
    test2 = Replace(test, "'", "")

hope this helps :o)
   
0

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
bad_seedCommented:
oh, bear in mind the value will still be a String and NOT a number

for that, extract the ' using the code i mentioned and then use the conversion techniques by Idle_Mind
0
burningmaceCommented:
I know what he means. He wants to convert a String to an Integer

Balls = Val(Testies)

That's it.
The power of the single lined code reveals itself.

Hope it works,
Burningmace
0
Mike TomlinsonMiddle School Assistant TeacherCommented:
> I know what he means. He wants to convert a String to an Integer
>
> Balls = Val(Testies)

> That's it.
> The power of the single lined code reveals itself.
>
> Hope it works,
> Burningmace

Except that an Integer can only hold from -32,768 to 32,767.  

So in your case burningmace, the Val() function would return a Long, not an Integer like you said.

Dim Testies As String
Testies = "99876"
Balls = Val(Testies) ' <----- Balls was not declared, so it implicitly becomes a Long

< versus >

Dim Testies As String
Testies = "99876"
Dim Balls As Integer
Balls = Val(Testies) ' <---- Overflow Error

"The power of the single lined code reveals itself."  ---> Translation: Lazy coding causes unexpected results.

Idle_Mind
0
ThermosAuthor Commented:
sorry for the late reply.  something came up.

and sorry i didnt explain my question better guys.  i am pulling the info with an array from a .log file.  what i pull out is '9987' (which is how it shows in the .log file) i simply needed to get rid of the 's.

bad_seed.  Mid(test, 2, (Len(test) - 2)) is exactly what i needed.  thank you.  i had been trying to use replace, len, etc but was not using them properly.

thanks again for the help guys.
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
Visual Basic Classic

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.