WideBoyDixon Posted April 23, 2009 Share Posted April 23, 2009 Could be used to convert to binary (for example). Also allows padding of the result. ConsoleWrite(_ToBase(15, 2, 8) & @CRLF) ConsoleWrite(_ToBase(257, 3) & @CRLF) ConsoleWrite(_ToBase(255, 4) & @CRLF) ConsoleWrite(_ToBase(932, 8) & @CRLF) ConsoleWrite(_ToBase(65535, 16, 8) & @CRLF) Exit Func _ToBase($iNumber, $iBase, $iPad = 1) Local $sRet = "", $iDigit Do $iDigit = Mod($iNumber, $iBase) If $iDigit < 10 Then $sRet = String($iDigit) & $sRet Else $sRet = Chr(55 + $iDigit) & $sRet EndIf $iNumber = Int($iNumber / $iBase) Until ($iNumber = 0) And (StringLen($sRet) >= $iPad) Return $sRet EndFunc WBD FourLC and Loz 2 [center]Wide by name, Wide by nature and Wide by girth[u]Scripts[/u]{Hot Folders} {Screen Calipers} {Screen Crosshairs} {Cross-Process Subclassing} {GDI+ Clock} {ASCII Art Signatures}{Another GDI+ Clock} {Desktop Goldfish} {Game of Life} {3D Pie Chart} {Stock Tracker}[u]UDFs[/u]{_FileReplaceText} {_ArrayCompare} {_ToBase}~ My Scripts On Google Code ~[/center] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now