Core runtime library providing primitive types (Bool, Byte, Char, Int, Float, String), the Ref wrappers and array helpers, and system utilities (console, files, threads, sockets). Collections are not here: they are in gen_collect.obl. Every Objeck program links against this bundle automatically via lang.obl.
Char
Character class represents a Unicode character value.
Operations
- Clamp
- Clear
- Compare
- Copy
- Error
- ErrorLine
- Fill
- Find
- FindAll
- IsChar
- IsDigit
- IsLower
- IsUpper
- IsWhitespace
- Max
- Min
- Sort
- ToByte
- ToBytes
- ToFloat
- ToHexString
- ToInt
- ToLower
- ToString
- ToStringUnsigned
- ToUpper
Clamp # function
Returns a given value between an upper and lower bound
function : Clamp(min:Char, value:Char, max:Char) ~ CharParameters
| Name | Type | Description |
|---|---|---|
| min | Char | minimal value |
| value | Char | value between the min and max |
| max | Char | maximum value |
Return
| Type | Description |
|---|---|
| Char | min if vaule is less than main, max if max is less than value, otherwise the value |
Clear # function
Set all array elements to zero
function : Clear(c:Char[]) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| c | Char | array |
Compare # native
Compares two values
function : native : Compare(l:Char, r:Char) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| l | Char | left compare object |
| r | Char | right compare object |
Return
| Type | Description |
|---|---|
| Int | 0 if equal, -1 if types differ, 1 if equal |
Copy # function
Copies elements between two character arrays, or within one: overlapping ranges copy as if through a temporary array. Raises an IndexError, which a try/on or ?-> region can recover from, when a range does not fit its array; nothing is copied then.
function : Copy(dest:Char[], dest_offset:Int, src:Char[], src_offset:Int, count:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| dest | Char | destination array |
| dest_offset | Int | first destination index |
| src | Char | source array |
| src_offset | Int | first source index |
| count | Int | number of elements to copy; zero copies nothing |
Example
a := ['a', 'b', 'c', 'd']
Char->Copy(a, 1, a, 0, 3); # shifts the first three elements right by oneFill # function
Sets every element of an array to a value
function : Fill(array:Char[], value:Char) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| array | Char | array |
| value | Char | value |
Fill # function
Sets a range of array elements to a value. Raises an IndexError, which a try/on or ?-> region can recover from, when the range does not fit the array; nothing is set then.
function : Fill(array:Char[], value:Char, offset:Int, count:Int) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| array | Char | array |
| value | Char | value |
| offset | Int | first index |
| count | Int | number of elements to set; zero sets nothing |
Find # native
Searches for the first occurrence of a byte
function : native : Find(chars:Char[], search:Char) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| chars | Char | character array to search |
| search | Char | byte to search for |
Return
| Type | Description |
|---|---|
| Int | true of found, false otherwise |
Find # native
Searches for the first occurrence of a byte
function : native : Find(chars:Char[], offset:Int, search:Char) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| chars | Char | character array to search |
| offset | Int | search offset |
| search | Char | byte to search for |
Return
| Type | Description |
|---|---|
| Int | true of found, false otherwise |
Find # native
Searches for the first occurrence of a character array
function : native : Find(chars:Char[], search:Char[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| chars | Char | character array to search |
| search | Char | character array to search for |
Return
| Type | Description |
|---|---|
| Int | index of first occurrence, -1 otherwise |
Find # native
Searches for the first occurrence of a character array
function : native : Find(chars:Char[], offset:Int, search:Char[]) ~ IntParameters
| Name | Type | Description |
|---|---|---|
| chars | Char | character array to search |
| offset | Int | search offset |
| search | Char | character array to search for |
Return
| Type | Description |
|---|---|
| Int | index of first occurrence, -1 otherwise |
FindAll # function
Searches for all occurrences of the character array
function : FindAll(chars:Char[], search:Char[]) ~ Int[]Parameters
| Name | Type | Description |
|---|---|---|
| chars | Char | character array to search |
| search | Char | character array to search for |
Return
| Type | Description |
|---|---|
| Int | an array of indexes |
IsChar # native
Checks of the character is a alpha digit
function : native : IsChar() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if alpha digit, false otherwise |
IsDigit # native
Checks of the character is a numeric digit
function : native : IsDigit() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if numeric digit, false otherwise |
IsLower # native
Checks if the character is lower-case
function : native : IsLower() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if lower-case, false otherwise |
IsUpper # native
Checks if the character is upper-case
function : native : IsUpper() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if upper-case, false otherwise |
IsWhitespace # native
Checks of the character is white space
function : native : IsWhitespace() ~ BoolReturn
| Type | Description |
|---|---|
| Bool | true if white space, false otherwise |
Max # native
Returns the largest byte value
function : native : Max(l:Char, r:Char) ~ CharParameters
| Name | Type | Description |
|---|---|---|
| l | Char | value to compare |
| r | Char | value to compare |
Return
| Type | Description |
|---|---|
| Char | largest byte value |
Min # native
Returns the smallest byte value
function : native : Min(l:Char, r:Char) ~ CharParameters
| Name | Type | Description |
|---|---|---|
| l | Char | value to compare |
| r | Char | value to compare |
Return
| Type | Description |
|---|---|
| Char | smallest byte value |
ToByte # function
Returns the Character value
function : ToByte() ~ ByteReturn
| Type | Description |
|---|---|
| Byte | value |
ToBytes # function
Converts the character array to a byte array
function : ToBytes(c:Char[]) ~ Byte[]Parameters
| Name | Type | Description |
|---|---|---|
| c | Char | character array |
Return
| Type | Description |
|---|---|
| Byte | byte array |
ToFloat # function
Returns the Float value
function : ToFloat() ~ FloatReturn
| Type | Description |
|---|---|
| Float | value |
ToHexString # native
Returns a hex string value
function : native : ToHexString() ~ StringReturn
| Type | Description |
|---|---|
| String | hex string value |
ToLower # function
Converts character to lower-case
function : ToLower() ~ CharReturn
| Type | Description |
|---|---|
| Char | lower-case representation |
ToString # function
Returns a string representation of the char array
function : ToString(v:Char[,]) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| v | Char | char array |
Return
| Type | Description |
|---|---|
| String | string representation of the char array |
ToString # native
Returns a string representation of the value
function : native : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation of the value |