Files
processing4/mobile/web/reference/API/byteconvert.xml
2005-01-27 06:48:42 +00:00

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 &amp; 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>