Kaba class string ed
A chunk of text, a list of characters.
Syntax ed
class string
var num: i32
# constructors
func mut __init__()
# functions
func mut add(x: u8)
func mut clear()
func pure compare(str: string) -> i32
func pure encode() -> bytes
func pure escape() -> string
func pure explode(str: string) -> string[]
func pure find(str: string, start: i32) -> i32?
func pure format(fmt: string) -> string
func pure hash() -> i32
func pure head(size: i32) -> string
func pure hex() -> string
func pure icompare(str: string) -> i32
func mut insert(x: u8, index: i32)
func pure lower() -> string
func pure match(glob: string) -> bool
func pure parse_tokens(splitters: string) -> string[]
func mut remove(index: i32)
func pure repeat(n: i32) -> string
func pure replace(sub: string, by: string) -> string
func mut resize(num: i32)
func pure reverse() -> string
func pure tail(size: i32) -> string
func pure trim() -> string
func pure unescape() -> string
func pure unhex() -> bytes
func pure upper() -> string
func pure utf8_length() -> i32
func pure utf8_to_utf32() -> i32[]
func static pure decode(b: bytes) -> string
# operators
# string[i32] -> u8
func selfref __subarray__(start: i32, end: i32) -> string # string[i32:i32] -> string
func pure __str__() -> string # str(string) -> string
func mut __assign__(b: string) # string = string
func pure __contains__(b: u8) -> bool # u8 in string -> bool
func pure __bitor__(b: string) -> string # string | string -> string
func mut __iadd__(b: string) # string += string
func pure __add__(b: string) -> string # string + string -> string
func pure __eq__(b: string) -> bool # string == string -> bool
func pure __neq__(b: string) -> bool # string __neq__ string -> bool
func pure __lt__(b: string) -> bool # string < string -> bool
func pure __le__(b: string) -> bool # string <= string -> bool
func pure __gt__(b: string) -> bool # string > string -> bool
func pure __ge__(b: string) -> bool # string >= string -> bool
func pure __i32__() -> i32 # i32(string) -> i32
func pure __i64__() -> i64 # i64(string) -> i64
func pure __f32__() -> f32 # f32(string) -> f32
func pure __f64__() -> f64 # f64(string) -> f64
func pure __repr__() -> string # repr(string) -> string
func pure __contains__(s: string) -> bool # string in string -> bool
Functions ed
- func mut add(x: u8)
- Add a single character to the string.
- func mut clear()
- ...
- func pure compare(str: string) -> i32
- ...
- func pure encode() -> bytes
- ...
- func pure escape() -> string
- "Add escapes to "problematic" characters (tab, linebreak, quotation, null).
- func pure explode(str: string) -> string[]
- Splits a string at each occurance of a sequence.
- func pure find(str: string, start: i32) -> i32?
- Find a sub-string in text.
- func pure format(fmt: string) -> string
- Formating helper, mostly used by string-interpolation.
- func pure hash() -> i32
- Calculates a very simple hash, a number (more or less) unique to each text input.
- func pure head(size: i32) -> string
- Selects characters from the beginning of a string.
- func pure hex() -> string
- Hexadecimal representation of binary.
- func pure icompare(str: string) -> i32
- ...
- func mut insert(x: u8, index: i32)
- ...
- func pure lower() -> string
- Turn all characters to lower case.
- func pure match(glob: string) -> bool
- ...
- func pure parse_tokens(splitters: string) -> string[]
- ...
- func mut remove(index: i32)
- ...
- func pure repeat(n: i32) -> string
- Glue several copies of a string together.
- func pure replace(sub: string, by: string) -> string
- Finds and replaces each occurance of a sequence within a string.
- func mut resize(num: i32)
- Resizes the string. Either cuts off or adds zero-characters at the end.
- func pure reverse() -> string
- Reverses the characters in text.
- func pure tail(size: i32) -> string
- Returns the last couple of characters.
- func pure trim() -> string
- Remove whitespace from start and end.
- func pure unescape() -> string
- ...
- func pure unhex() -> bytes
- Parse hexadecimal into binary.
- func pure upper() -> string
- Turn all characters to upper case.
- func pure utf8_length() -> i32
- Count characters when interpreting as utf8.
- func pure utf8_to_utf32() -> i32[]
- Convert utf8 to utf32
- func static pure decode(b: bytes) -> string
- ...
Elements ed
- var num: i32
- The number of characters (bytes).