Takes a text representation of a number in various formats and returns an AppleScript integer of the result. Can convert strings containing hex or binary or octal to a number as well as regular numerical strings.
text to number (text: representing a number. Use a number specifier below for special number systems)
returns an AppleScript Integer.
NOTE: real numbers containing decimals will be truncated. Use the standard “as number” conversion in AppleScript to convert those.
By using these prefixes to the number string this command can work with decimal numbers, binary numbers, hexadecimal numbers even octal numbers.
set myValue to (text to number “23”) set myHexValue to (text to number “&hA4B211”) set myBinaryValue to (text to number “&b1011010111”) set myOctalValue to (text to number “&o321274”)