mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 01:50:44 +01:00
62 lines
1.1 KiB
XML
62 lines
1.1 KiB
XML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
<root>
|
|
<name>byte()</name>
|
|
|
|
<category>Data</category>
|
|
|
|
<subcategory>Conversion</subcategory>
|
|
|
|
<usage>Web & Application</usage>
|
|
|
|
<example>
|
|
<image></image>
|
|
<code>
|
|
float f = 65.0;
|
|
byte b = byte(f);
|
|
println(f + " : " + b); // Prints "65.0 : 65"
|
|
|
|
char c = 'E';
|
|
b = byte(c);
|
|
println(c + " : " + b); // Prints "E : 69"
|
|
|
|
f = 130.0;
|
|
b = byte(f);
|
|
println(f + " : " + b); // Prints "130.0 : -126"
|
|
</code>
|
|
</example>
|
|
|
|
<description>
|
|
Converts a primitive datatype, string, or array to its byte representation. A byte can only be a whole number between -128 and 127, therefore when a number outside this range is converted, its value wraps to the corresponding byte representation.
|
|
</description>
|
|
|
|
<syntax>
|
|
byte(<c>val</c>)
|
|
</syntax>
|
|
|
|
<parameter>
|
|
<label>val</label>
|
|
<description>int, float, char, boolean, String, int[], float[], char[], boolean[], String[]</description>
|
|
</parameter>
|
|
|
|
<returns>byte</returns>
|
|
|
|
<related>
|
|
byte
|
|
int()
|
|
</related>
|
|
|
|
<availability>1.0</availability>
|
|
|
|
<type>Function</type>
|
|
|
|
<partof>IDE</partof>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</root>
|