Login Register
Frontpage Code library Pastebin

Bin2() & Hex2()

Author: misthema
Added: 25.4.2011 13:54
Edited: 25.4.2011 13:54
Category: Merkkijonot

Description

Bin2() ja Hex2() palauttavat halutun pituisen merkkijonon halutusta arvosta.

Code

Select all
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
Function Bin2$(val,digits=32)
	Return Right(Bin(val),Int(Max(1,Min(32,digits))))
End Function

Function Hex2$(val,digits=8)
	Return Right(Hex(val),Int(Max(1,Min(8,digits))))
End Function

val% = Rand(-2000000000,2000000000)

Print Bin(val)
Print Bin2(val,16)
Print Bin2(val,64)
Print ""
Print Hex(val)
Print Hex2(val,4)
Print Hex2(val,800)
WaitKey

Comments

No comments. You can be first!

Leave a comment

You must be logged in to comment.