IntToBin

From GECK
Jump to: navigation, search


A function added by the New Vegas Script Extender version 6.2.9.

Description

Converts a specified integer to a binary string, optionally padded to the specified width.

If the specified width is smaller than the minimum width to represent the number, will use the minimum width.

The maximum width is 32 bits.

If AddPrefix is set to true (non-zero), will prepend "0b" to the string.

Syntax

[help]
(string) IntToBin ToConvert:int WidthToPadTo:int{32} AddPrefix:bool{0} 

Example

string_var sBinary = IntToBin 42, 1
; sBinary  == "0b101010"

See Also