Page 1 of 1

[ERROR] inStr

Posted: 17 Oct 2017, 08:57
by _3D_
AutoHotkey_2.0-a081-cad307c

Code: Select all

msgBOX(inStr(     1.34, 34))		; 3 - OK
msgBOX(inStr(    12.34, 34))		; 0 - ERROR
msgBOX(inStr( 12.34 "", 34))		; 0 - ERROR
msgBOX(inStr(  "12.34", 34))		; 4 - OK
msgBOX(inStr(   123.34, 34))		; 5 - OK
msgBOX(inStr(  1256.34, 34))		; 0 - ERROR
msgBOX(inStr("1256.34", 34))		; 6 - OK
msgBOX(inStr( 12567.34, 34))		; 7 - OK
When characteristic even ERROR. Also

Code: Select all

a:= 12.34 ""
msgBOX(inStr(        a, 34))		; 0 - ERROR
Probably problem in float to string converting.

Re: [ERROR] inStr  Topic is solved

Posted: 18 Oct 2017, 06:36
by _3D_
[SOLUTION]

Code: Select all

a:= 12.34
msgBOX(inStr(format("{:f}", a), 34))
Float is not just digits and a dot so need real transformation to string.