oct_to_dec

Downloadoct_to_dec(oct)   Returns a non-negative integer converted from a string of octal digits.
/*
**  Usage:
**      oct_to_dec(oct)
**
**  Arguments:
**      oct     a string of octal digits, three bits per character
**
**  Returns:
**      a non-negative integer
**
**  GMLscripts.com
*/

{
    var oct,dec,o,p;
    oct = argument0;
    dec = 0;
    o = "01234567";
    for (p=1;p<=string_length(oct);p+=1) {
        dec = dec << 3 | (string_pos(string_char_at(oct,p),o)-1);
    }
    return dec;
}

Click if you've used this script[Please Login]
Projects: 5


comments powered by Disqus