IntToBinary
IntToBinary
Description
Convert an integer to a binary string.
Parameters
| Name | Direction | Description |
|---|---|---|
value |
in | Integer to convert |
Usage example (from documentation)
Str bits = IntToBinary(&value);Returns
Base-2 representation without a prefix.
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Int.c:559:
}
Str IntToBinary(Int *value) {
return IntToStrRadix(value, 2, false);
}- In
Int.Convert.c:40:
Int value = IntFrom(13);
Str text = IntToBinary(&value);
bool result = IntBitLength(&value) == 4;- In
Int.Convert.c:91:
Int value = IntFromBinary("001011");
Str text = IntToBinary(&value);
bool result = IntToU64(&value) == 11;
Int zero = IntFromBinary("0");
Str text = IntToBinary(&zero);
bool result = IntBitLength(&zero) == 0;- In
Io.Read.c:914:
z = "10100011";
StrReadFmt(z, "{b}", bin);
bin_text = IntToBinary(&bin);
success = success && (ZstrCompare(bin_text.data, "10100011") == 0);- In
Int.Math.c:98:
IntAdd(&result_value, &a, &b);
text = IntToBinary(&result_value);
bool result = IntToU64(&result_value) == 256;
Last updated on