I need to convert the values in the string to numeric values. I found this very difficult. Do you have any quick methods?
I found that converting them requires a complicated process:
e.g. ["6.9","232","-8.3"]
[v2] String to number Topic is solved
Re: String to number
You can just calculate with them?
In AHK every string can be used like a number as long as it only consists of a single number (e.g. the numbers you presented.)
In AHK every string can be used like a number as long as it only consists of a single number (e.g. the numbers you presented.)
Recommends AHK Studio
Re: String to number Topic is solved
There are two (suitable) functions available, integer and float.
Re: String to number
Yes, but as some DLL parameters, need to convert.
Re: String to number
Can you link the addresses of these two functions? I can't find.Helgef wrote:There are two (suitable) functions available, integer and float.
Re: String to number
https://lexikos.github.io/v2/docs/commands/Integer.htmarcticir wrote:Can you link the addresses of these two functions? I can't find.Helgef wrote:There are two (suitable) functions available, integer and float.
https://lexikos.github.io/v2/docs/commands/Float.htm
https://lexikos.github.io/v2/docs/commands/String.htm
https://lexikos.github.io/v2/docs/commands/Type.htm
Re: String to number
thank you very much. My "help document" is too old.
Re: String to number
One problem is that its conversion is not accurate, it is very bad when converting JSON data:
Float("6.9") ;==>6.9000000000000004
Float("6.9") ;==>6.9000000000000004
Re: String to number
You might be interested in this topic.
Re: String to number
this topic, in addition to explaining why "Float()" cannot be accurately converted, is there any help for "accurate conversion type"?
Re: String to number
AutoHotkeys floating point numbers are as precise as a double sized float (its the standar size).
If you want more precision you need a different type.
If you want more precision you need a different type.
Recommends AHK Studio
Re: String to number
The conversion is accurate. The data type is not (for decimal fractions). You can't even choose to use or simulate a different data type if you're using DllCall. At some point the value must be converted to the type that the external function requires.
Who is online
Users browsing this forum: Google [Bot], metallizer, Rohwedder and 40 guests