Methods of the system type objects
Here below are the methods accepted by the objects of a system type
and a list of allowed types to which they can be mapped.
Examples of the use of methods on the system objects:
"abc".subString(1,2)
2.binaryRep()
Examples of type conversion:
(string)7
(float)"1.23"
(int)(byte)(char)'a'
For more about system types and for a lists of accepted operators see Data types.
For methods accepted by: arrays see Arrays,
vector see Vector of values,
and for a sheet object see Sheet object.
Integer number - int
Integer object accepts methods:
method |
parameters |
description |
result |
binaryRep |
() |
returns array of 8 bytes, that represents 64-bit integer |
array of bytes |
fromBinaryRep |
(byteArr) |
returns 64-bit integer value from array of 8 bytes |
integer |
Object of int type
can be converted to system objects of type:
dest type |
conversion description |
bool |
returns false when 0, otherwhise true |
byte |
makes byte from the first (lowest) 8 bits of integer |
char |
returns character of given value |
float |
returns floating point value |
string |
returns string with a numeric value in decimal system |
Text value - string
String object accepts methods:
method |
parameters |
description |
result |
byteLength |
() |
returns number of bytes in UTF-8 string representation |
integer |
byteAt |
(pos) |
returns byte at given position in UTF-8 string representation;
position starts from 0 to byteLength-1 |
byte |
charLength |
() |
returns number of characters in string
(notice, that this is slow method, because
it must count characters from UTF-8 representation) |
integer |
charAt |
(pos) |
returns character at given position;
position starts from 0 to charLength-1 |
char |
length |
() |
returns length of the string;
this is the same as charLength method |
integer |
subString |
(from,count) |
returns substring, that contains characters from string,
starting at given position, of given length |
string |
getUniq |
() |
returns a unique string object (in given runtime envitonment)
that is equal to given string |
string |
newString |
(...) |
returns new string object,
that contains data from parameters |
string |
newSheet |
(...) |
returns new sheet object,
that contains data from parameters |
sheet |
Object of string type
can be converted to system objects of type:
dest type |
conversion description |
byte[] |
returns array of bytes in UTF-8 representation |
char[] |
returns array of characters |
sheet |
returns new sheet object that contains string |
byte |
returns first byte in UTF-8 representation |
char |
returns first character of the string |
bool |
converts "true" to true, "false" to false,
otherwhise it throws exception |
int |
parsing an integer number from string |
float |
parsing a floating point number from string |
Boolean value - bool
Boolean object accepts no methods.
Object of bool type
can be converted to system objects of type:
dest type |
conversion description |
int |
returns 1 for true and 0 for false |
string |
returns "true" for true and "false" for false |
byte |
conversion through integer type |
char |
conversion through integer type |
float |
conversion through integer type |
Character - char
Character object accepts no methods.
Object of char type
can be converted to system objects of type:
dest type |
conversion description |
int |
returns numeric value of character |
byte |
returns byte, when numeric value is between 0 and 255;
otherwise throws exception |
byte[] |
returns array of bytes of UTF-8 char representation |
string |
returns string that contains single character |
bool |
conversion through integer type |
float |
conversion through integer type |
Byte - byte
Byter object accepts no methods.
Object of byte type
can be converted to system objects of type:
dest type |
conversion description |
int |
returns integer of the same value |
bool |
conversion through integer type |
char |
conversion through integer type |
float |
conversion through integer type |
string |
conversion through integer type |
Floating point number - float
Floating point number object accepts methods:
method |
parameters |
description |
result |
binaryRep |
() |
returns array of 8 bytes, that represents 64-bit float |
array of bytes |
fromBinaryRep |
(byteArr) |
returns 64-bit float value from array of 8 bytes |
float |
Object of float type
can be converted to system objects of type:
dest type |
conversion description |
bool |
returns false when 0.0, otherwhise true |
int |
rounds float number to the integer;
throws exception when value is out of range |
string |
writes number in decimal system to the six places after dot;
last zeros in representation will cutted, except first zero |
byte |
conversion through integer type |
char |
conversion through integer type |
Many mathematical functions on the float value are available from the math library,
see Math linked library.
|