Jump to content

base converter dlg - updated 15/6/09


Mat
 Share

Recommended Posts

Another program addon i've done, this one is as professional as possible, with context help (thanks to yashied), and calculating as you type etc.

Thanks to WBD for his improved _ToBase + _FromBase functions.

My main problems was the calculating as you type, as it led to a very slow program at times, but after I figured out a good method to do the roman numerals, I was pretty much sorted! The other one was using contexthelp with a window set on top, and I still haven't worked that one out...

Thanks also to yashied, for the nice nd easy context help udf's.

Download link

Downloads so far is shown on the download page

Mat

Edit: Updated download link.

Edited by Mat
Link to comment
Share on other sites

Your _IntToAny() function looks very complex! Granted that this doesn't have the error checking but it's a bit simpler:

Func _ToBase($iNumber, $iBase, $iPad = 1)
    Local $sRet = "", $iDigit
    Do
        $iDigit = Mod($iNumber, $iBase)
        $sRet = Chr(48 + $iDigit + 7 * ($iDigit > 9)) & $sRet
        $iNumber = Int($iNumber / $iBase)
    Until ($iNumber = 0) And (StringLen($sRet) >= $iPad)
    Return $sRet
EndFunc   ;==>_ToBase

WBD

Link to comment
Share on other sites

A companion function for _ToBase() is:

Func _FromBase($sNumber, $iBase)
    Local $iRet = 0, $sChar
    Do
        $iRet *= $iBase
        $sChar = StringLeft($sNumber, 1)
        $iRet += Asc($sChar) + 7 * (Asc($sChar) < 58) - 55
        $sNumber = StringMid($sNumber, 2)
    Until $sNumber = ""
    Return $iRet
EndFunc

HTH

WBD

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...