Example Script: How to convert a string containing a Hexidecimal number to its Decimal equivalent. The zip file contains the sample ITB, designed with ITScriptNet 3.1.
Conversion script:
; get the input and make it upper case
@Input@ = UCase(this.txtInput.Value)
; initialize the decimal portion
@dec@ = 0
; loop through the string
while(Len(@Input@) > 0)
; get the first character and truncate the string
@char@ = Left(@Input@, 1)
@Input@ = Mid(@Input@, 2, Len(@Input@)-1)
; multiply the old data
@dec@ = @dec@ * 16
; convert the single hex character to decimal
if((ASC(@char@) >= ASC("A")) && (ASC(@char@) <= ASC("F")))
; character A to F
@char@ = ASC(@char@) - ASC("A") + 10
elseif((ASC(@char@) >= ASC("0")) && (ASC(@char@) <= ASC("9")))
; character 0 - 9
@char@ = ASC(@char@) - ASC("0")
else
; treat illegal characters as 0
@char@ = 0
endif
; accumulate
@dec@ = @dec@ + @char@
wend