Jump to content

Converting string to a number


Achilles
 Share

Recommended Posts

I alright, I have an input box, where the user will presumably put in a number, but when I do GuiCtrlRead($input) it obviously returns it as "56" (or whatever number). Then I do a check to see if the input box has been filled out and I was trying to use "Isnumber(Guictrlread($input)) but it's not working. I didn't see any thing in the helpfile (although I didn't search very hard)... any help greatly appreciated

Edit: Sorry about the typo in my subject name! (But you can't change it, or so I think)

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Maybe something like?

If StringLen(Guictrlread($input)) Then 
    If IsNumber(Guictrlread($input)) Then $number = Number(Guictrlread($input))
EndIf
Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Maybe something like?

If StringLen(Guictrlread($input)) Then 
    If IsNumber(Guictrlread($input)) Then $number = Number(Guictrlread($input))
EndIf

Alright, sweet, thanks for that gafrost. I used the "$number = Number(Guictrlread($input))" part and that worked fine. I didn't test the other part but I don't think it would of worked because IsNumber(GuiCtrlread($input)) would of returned string with a number in it, and that wouldn't of been accepted as a number.... at least I think that would of happened...

@Hallman: No that isn't really what I was looking for but now that you mention it that would be very useful, thanks!

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...