A built-in property is a special value or function for specific type that can be called in the same notation as an object property.
// example
'ai kawaii'.len //9
Core:range(0,2).push(4) //[0,1,2,4]
Currently, built-in properties for types number, string, array, and error are available.
The object equivalent is implemented as std function due to confliction of notation.
#(v: type_name).prop_name
Prefix # indicates it is a primitive property that is not a function.
@(v: type_name).prop_name(args): return_type
Prefix @ indicates it is a primitive property that is a function.
Gets string representation of the number.
type: num
Length of the string.
Gets the numeric value that the string represents.
Gets the character at index .
Checks for the presence of keyword in the string.
Obtains specified portion of the string.
Returns the string separated into array at the point where the splitter is located.
Returns the string with including old (s) replaced with new.
Searches for search in the string and returns its index.
Returns the string with leading and trailing whitespace removed.
Returns the string converted to uppercase.
Returns the string converted to lowercase.
Gets the codepoint of the character at index.
Returns null if the character does not exist there.
type: num
Number of elements in the array.
MODIFIES THE ARRAY
Appends an element to the end of the array.
MODIFIES THE ARRAY*
Prepends an element to the beginning of the array.
MODIFIES THE ARRAY*
Extracts the last element of the array.
MODIFIES THE ARRAY*
Extracts the first element of the array.
Returns an array concatenating the array and b.
Combines all elements of the string array and returns them as a single string.
Obtains specified portion of the array.
Checks if there is an element in the array with the value val.
Executes func for each element of the array asynchronously.
Returns the array of results.
Executes func for each element of the array asynchronously.
Returns only those elements of the array for which func returns true.
Executes func for each element in turn.
func is given the previous result as acm.
if initial is given, func is initially called with arguments (initial, v[0], 0).
Otherwise, (v[0], v[1], 1).
Finds elements in the array such that func returns true.
Finds a value that equals to val, and returns the index.
If fromIndex is given, the search starts from there.
When fromIndex is negative, index from the end(length of the array + fromIndex) is used.
When not found, returns -1.
Modifying Reverses the array.
Generates a copy of the array.
MODIFIES THE ARRAY*
Sorts the array.
comp is the comparison function that returns:
- negative value if a should precede b
- positive value if a should succeed b
- 0 if either is acceptable
Str:lt
and Str:gt
are available as comparison function. See std.md
type: str
Identifier string of the error.
type: value
Additional information about the error, if any.