Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,36 @@
|
|||
Global alphanum$ = "0123456789abcdefghijklmnopqrstuvwxyz" ;36 digits
|
||||
#maxIntegerBitSize = SizeOf(Integer) * 8
|
||||
|
||||
Procedure toDecimal(base, s.s)
|
||||
Protected length, i, toDecimal
|
||||
|
||||
length = Len(s)
|
||||
If length: toDecimal = FindString(alphanum$, Left(s, 1), 1) - 1: EndIf
|
||||
|
||||
For i = 2 To length
|
||||
toDecimal * base + FindString(alphanum$, Mid(s, i, 1), 1) - 1
|
||||
Next
|
||||
ProcedureReturn toDecimal
|
||||
EndProcedure
|
||||
|
||||
Procedure.s toBase(base, number)
|
||||
Protected i, rem, toBase.s{#maxIntegerBitSize} = Space(#maxIntegerBitSize)
|
||||
|
||||
For i = #maxIntegerBitSize To 1 Step -1
|
||||
rem = number % base
|
||||
PokeC(@toBase + i - 1, PeekC(@alphanum$ + rem))
|
||||
If number < base: Break: EndIf
|
||||
number / base
|
||||
Next
|
||||
ProcedureReturn LTrim(toBase)
|
||||
EndProcedure
|
||||
|
||||
If OpenConsole()
|
||||
PrintN( Str(toDecimal(16, "1a")) )
|
||||
|
||||
PrintN( toBase(16, 26) )
|
||||
|
||||
Print(#CRLF$ + #CRLF$ + "Press ENTER to exit")
|
||||
Input()
|
||||
CloseConsole()
|
||||
EndIf
|
||||
Loading…
Add table
Add a link
Reference in a new issue