Tracking Issue: List of Methods in Ion
String Methods
String methods return strings
-
$len(string) -> n string -
$len(array) -> n string (@mmstick) -
$len_bytes(string) -> n string -
$join(array) -> string -
$find(string, string) -> n string -
$starts_with(string, string) -> 0/1 string (@mmstick) -
$ends_with(string, string) -> 0/1 string (@mmstick) -
$contains(string, string) -> 0/1 string (@mmstick) -
$replace(string, string) -> string (@mmstick) -
$replacen(string, string) -> string (@mmstick) -
$to_lowercase(string) -> string (@pithonsmear) -
$to_uppercase(string) -> string (@pithonsmear) -
$repeat(string, n) -> string (@mmstick) -
$extension(filepath) -> string (@pithonsmear) -
$basename(filepath) -> string (@pithonsmear) -
$parent(filepath) -> string (@pithonsmear) -
$filename(filepath) -> string (@pithonsmear) -
$or(string, expr) -> string - If the given string does not exist, use the given expression
-
$reverse(string) -> string (@pithonsmear) -
$fold(array, string) -> string - Apply a reduce/fold function to an array
- The supplied string should name a command to apply to the array
-
$open(string) -> string - Open a file and buffer the entire file into memory
-
$regex_replace(string, string) - Same as $replace(), but the pattern is a regex expression
Array Methods
Array methods return arrays
-
@split(string, opt) -> array -
@bytes(string) -> array -
@chars(string) -> array -
@graphemes(string) -> array -
@reverse(array) -> array -
@lines(string) -> array - Split a given string by newlines
-
@filter(array, string) -> array - Apply a filter command to each element in the array
- Exit status determines which values to filter
@filter(array, x => matches $x '([F])\w+')
-
@map(array, string) -> array - Apply a command to each element in the array
- Output of the command is the new value for that index
@map(array, x => calc $x + $x)
-
@open(array, opt) -> array - If no pattern string is supplied, split the file by newlines
-
@split_at(string, n) -> [string, string] - Splits a string into a two-element array; Rust's std
-
@split_args(string) - Provides an interface for the
ArgumentSplitter
functionality in the shell.
- Provides an interface for the
Edited by matu3ba