Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,28 @@
|
|||
function strtol(str, base)
|
||||
{
|
||||
symbols = "0123456789abcdefghijklmnopqrstuvwxyz"
|
||||
res = 0
|
||||
str = tolower(str)
|
||||
for(i=1; i < length(str); i++) {
|
||||
res += index(symbols, substr(str, i, 1)) - 1
|
||||
res *= base
|
||||
}
|
||||
res += index(symbols, substr(str, length(str), 1)) - 1
|
||||
return res
|
||||
}
|
||||
|
||||
function ltostr(num, base)
|
||||
{
|
||||
symbols = "0123456789abcdefghijklmnopqrstuvwxyz"
|
||||
res = ""
|
||||
do {
|
||||
res = substr(symbols, num%base + 1, 1) res
|
||||
num = int(num/base)
|
||||
} while ( num != 0 )
|
||||
return res
|
||||
}
|
||||
|
||||
BEGIN {
|
||||
print strtol("7b", 16)
|
||||
print ltostr(123, 16)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue