fn array_new_string() -> [string] #[builtin(ArrayNew)] {} fn print(msg: string) #[builtin(Print)] {} fn array_push_string(array: [string], str: string) #[builtin(ArrayPush)] {} fn string_push_char(str: string, value: int) #[builtin(StringPushChar)] {} fn string_char_at(str: string, index: int) -> int #[builtin(StringCharAt)] {} fn string_length(str: string) -> int #[builtin(StringLength)] {} fn array_string_length(array: [string]) -> int #[builtin(StringLength)] {} fn array_string_at(array: [string], index: int) -> string #[builtin(ArrayAt)] {} fn char(ch: string) -> int { string_char_at(ch, 0) } fn split(str: string, seperator: int) -> [string] { let result: [string] = array_new_string(); let i = 0; let current_str = ""; loop { let char = string_char_at(str, i); if char == seperator { array_push_string(result, current_str); current_str = ""; } else { string_push_char(current_str, char); } if string_length(str) - 1 == i { break; } i = i + 1; } result } fn main() { let array = split("aoisfjasoifjsaiofjsa", char("a")); let i = 0; loop { print(array_string_at(array, i) + "\n"); i = i + 1; if array_string_length(array) - 1 == i { break; } } }