Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: alyonHi Jiken,
Thanks for your response and solution.
I have also developed a function to do the task,
length = hexString.strlen()
n = 0
decimalnumber = 0
while(n < length)
{
i = hexString.substr(length-1-n, 1).switch(
"0",0,
"1",1,
"2",2,
"3",3,
"4",4,
"5",5,
"6",6,
"7",7,
"8",8,
"9",9,
"A",10,
"a",10,
"B",11,
"b",11,
"C",12,
"c",12,
"D",13,
"d",13,
"E",14,
"e",14,
"F",15,
"f",15,
-1
)
if i == -1 then
{
decimalnumber = null
break
}
decimalnumber = decimalnumber + (i * pow(16,n))
n = n + 1
}
emit decimalnumber.str() as decimalString
I guess both functions will do the job, but having an inbuilt function would have been easy to use
Regards
Anshul