GetDigitValue()

Namespace ›› System ›› MfCharUnicodeInfo ››
Parent Previous Next

GetDigitValue()

OutputVar := MfCharUnicodeInfo.GetDigitValue(ch)
OutputVar := MfCharUnicodeInfo.GetDigitValue(s, index)

GetDigitValue(ch)

Gets the digit value of the specified numeric character.

GetDigitValue(s, index)

Gets the digit value of the specified for the numeric character in string s  at the location of Zero-based index.

Parameters

ch

The Unicode character for which to get the digit value. Can be instance of MfChar, A single char in a var or a string var containing hex value such as "0x00B2" (SUPERSCRIPT TWO) or MfInteger instance.

s

The String containing the Unicode character for which to get the decimal digit value. Can be MfString instance or String var.

index

The zero-based index of the Unicode character for which to get the decimal digit value. Can be MfInteger Instance or Integer var.

Returns

Returns the digit value of the specified numeric character.-or- -1, if the specified character is not a digit.

Throws

Throws MfArgumentOutOfRangeException is outside the range of valid indexes in s.
Throws MfArgumentException if ch, s or index are object but not of the expected type.

Example

var := MfCharUnicodeInfo.GetDigitValue(1)
MsgBox %var% ; displays 1 as it is taken as literal same as MfCharUnicodeInfo.GetDigitValue("0x0031")

var := MfCharUnicodeInfo.GetDigitValue("0x0033") ; valid range is 0x0000 to 0xFFFF
MsgBox %var% ; displays 3 as it is taken as literal same as MfCharUnicodeInfo.GetDigitValue("0x0033")

var := MfCharUnicodeInfo.GetDigitValue("a") ; 'a' has no Unicode Number value
MsgBox %var% ; displays -1 as it is taken as literal same as MfCharUnicodeInfo.GetDigitValue("0x0061")

var := MfCharUnicodeInfo.GetDigitValue("0x0F33") ; '0x0F33' TIBETAN DIGIT HALF ZERO
MsgBox %var% ; displays -1 does not have a Digit Value

myInt := new MfInteger(0x2788) ; same as new MfInteger(10120)
var := MfCharUnicodeInfo.GetDigitValue(myInt) ; '0x2788' CIRCLED SANS-SERIF DIGIT NINE
MsgBox %var% ; displays 9

HexChar := 0x2788 ; Decimal value is 10120 - (CIRCLED SANS-SERIF DIGIT NINE)
strHexChar := "0x2788" ; string of hex value, valid range is 0x0000 to 0xFFFF

var := MfCharUnicodeInfo.GetDigitValue(strHexChar) ; '0x2788' CIRCLED SANS-SERIF DIGIT NINE
MsgBox %var% ; displays 9

var := MfCharUnicodeInfo.GetDigitValue(HexChar) ; hex char is not a string contain hex value and will not work
MsgBox %var% ; displays -1

var := MfCharUnicodeInfo.GetDigitValue("Hello World 2015", 12)
MsgBox %var% ; displays 2 - zero based index put 12 at the position of 2 in 2015

var := MfCharUnicodeInfo.GetDigitValue("Hello World 2015", 15)
MsgBox %var% ; displays 5 - zero based index put 15 at the position of 5 in 2015

myStr := new MfString("Hello world 2015")
myInt := new MfInteger(15)
var := MfCharUnicodeInfo.GetDigitValue(myStr, myInt)
MsgBox %var% ; displays 5 - zero based index put 15 at the position of 5 in 2015

myChar := new MfCharUnicodeInfo("8")
var := MfCharUnicodeInfo.GetDigitValue(myChar)
MsgBox %var% ; displays 8

myChar := new MfCharUnicodeInfo(new MfInteger(0x2788)) ; '0x2788' CIRCLED SANS-SERIF DIGIT NINE
var := MfCharUnicodeInfo.GetDigitValue(myCh