Jump to content
Sign in to follow this  
nullschritt

convert text to base 13

Recommended Posts

nullschritt

So I have been searching for sometime on how to convert text to base 13, and found not much i understand can anyone help explain how to do this.? thanks

Edited by nullschritt

Share this post


Link to post
Share on other sites
pieeater

do you mean something like

$string = '1234'
ConsoleWrite(Number($string)&@CRLF) ;run this in scite to get the output

or are you trying to turn something like 'abc' into numbers?


[spoiler]My UDFs: Login UDF[/spoiler]

Share this post


Link to post
Share on other sites
hannes08

Did you mean something like discussed in this thread:


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites
nullschritt

I ended up figuring it out for myself thanks though. And no i meant actually converting them to be base13.

Func _Base($iDecNumber, $sChar)
Local $aBase = StringSplit($sChar, ",")
Local $iBase = $aBase[0]

Local $iLen = Int(Log($iDecNumber) / Log($iBase)) + 1

Dim $iUnit[$iLen + 1]
Local $iReturn
Local $iTemp = $iDecNumber

If $aBase[0] <> $iBase Then
SetError(1)
Return -1
EndIf

If $iDecNumber = 0 Then Return $aBase[1]

For $i = 1 To $iLen
For $i2 = 1 To $i - 1
$iTemp = $iTemp / $iBase
Next
$iUnit[$i] = $aBase[Mod($iTemp, $iBase) + 1]
$iTemp = $iDecNumber
Next

For $i = 1 To $iLen
$iReturn = $iUnit[$i] & $iReturn
Next

Return $iReturn
EndFunc ;==>_Base

Share this post


Link to post
Share on other sites
nullschritt

Thanks but I got to work how i need to. I'm using a custom number system with unicode chars(not the ones shown here).

I'm working on a base 104 encoding that uses the base elements to represent text (molecules from the periodic table)

And I am working on a way to combine elements based on chemical bonding. To make a sort of universal base set....

Sorry about my bad english.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×