Lasso Soft Inc. > Home

[ string->digit ]

Method

[String->Digit] returns the integer value of a specified character for a specified radix or -1 if the character is not defined for the specified radix. The character within the base string to be inspected is specified starting from 1 for the first character in the string. A radix of 16 can be used to return the value of a hexadecimal digit (0-9 and A-F). A radix of 8 can be used to return the value of an octal digit (0-7). A radix of 2 can be used to return the value of a binary digit (0-1).

  • Syntax
'String Value'->digit(integer,integer)
Examples
  • Beginner

To return the digit value for a character within a specific base:

Use the [String->Digit] method. The following example returns the value of the fourth character in hexadecimal base 16. The result for C in base 16 is 12.

Code

'DEFC012'->digit(4,16)

Result

12

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft