Base2Dec
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
This function converts a number to decimal from any base (up to 16). Its parameters are the number to be converted, and the base to convert from.
<lsl> integer sbBase2Dec(string strNumber, integer intBase) {
string strDigits = "0123456789abcdef"; integer intDigit = -llStringLength(strNumber); integer intReturn = 0;
while(intDigit) intReturn = (intReturn * intBase) + llSubStringIndex(strDigits, llGetSubString(strNumber, intDigit, intDigit++)); return intReturn;
} </lsl>