binary()
Data / ConversionDescription
Converts an integer to a binary string representation (32 characters).
Syntax
std::string binary(int v)
Parameters
| Name | Type | Description |
|---|---|---|
| v | int | value to convert |
Returns
std::stringRelated
Under the Hood
From Processing.h:
inline std::string binary(int v) { std::string s; for(int i=31;i>=0;i--) s+=((v>>i)&1)?'1':'0'; return s; }
static std::string binary(int v);
Under the Hood
From Processing.cpp:
std::string PApplet::binary(int v) {
std::string r; for(int i=31;i>=0;i--) r+=((v>>i)&1)?'1':'0'; return r;
}