Confusion with number strings Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
slimpickens
Posts: 9
Joined: 04 Jul 2017, 06:41

Confusion with number strings

22 Jul 2017, 16:27

Why is this blank, I thought ahk treated number strings as numbers in this case?

Code: Select all

[code]
oldCount = 1,234,000 
newCount = 1234500
change := newCount - oldCount ; empty
kon
Posts: 1756
Joined: 29 Sep 2013, 17:11

Re: Confusion with number strings

22 Jul 2017, 16:42

Hey, try this:

Code: Select all

var := "1,234,000"  ; Note the non-digit characters (',')
MsgBox % var + 0

var := "1234000"
MsgBox % var + 0
HTH :)
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Confusion with number strings  Topic is solved

22 Jul 2017, 17:05

Could be good:

Code: Select all

q::
oldCount = 1,234,000
newCount = 1234500
oldCount := StrReplace(oldCount, ",")
MsgBox, % change := newCount - oldCount
return

w::
oldCount = 1,234,000
newCount = 1234500
MsgBox, % change := newCount - StrReplace(oldCount, ",")
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
slimpickens
Posts: 9
Joined: 04 Jul 2017, 06:41

Re: Confusion with number strings

23 Jul 2017, 08:16

jeeswg wrote:Could be good:
Nice one, this made me realise that the google sheets api I used defaults to formatted values, I changed it to unformatted and I don't need to convert it in ahk anymore.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: jaka1 and 182 guests