123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- echo '# ANCHOR: lines'
- echo @lines($unescape("firstline\nsecondline"))
- for line in @lines($unescape("third\nfourth\nfifth"))
- echo $line
- end
- echo '# ANCHOR_END: lines'
- echo '# ANCHOR: split'
- echo @split("onetwoone" "two")
- for data in @split("person, age, some data" ", ")
- echo $data
- end
- for data in @split("person age data")
- echo $data
- end
- echo '# ANCHOR_END: split'
- echo '# ANCHOR: split_at'
- echo @split_at("onetwoone" "3")
- echo @split_at("FOOBAR" "3")
- #echo @split_at("FOOBAR") #ion: expansion error: split_at: requires an argument
- #echo @split_at("FOOBAR" "-1") #ion: expansion error: split_at: requires a valid number as an argument
- #echo @split_at("FOOBAR" "8") #ion: expansion error: split_at: value is out of bounds
- echo '# ANCHOR_END: split_at'
- echo '# ANCHOR: bytes'
- echo @bytes("onetwo")
- echo @bytes("abc")
- echo '# ANCHOR_END: bytes'
- echo '# ANCHOR: chars'
- echo @chars("onetwo")
- for char in @chars("foobar")
- echo $char
- end
- echo '# ANCHOR_END: chars'
- echo '# ANCHOR: graphemes'
- echo @graphemes("onetwo" "3")
- for grapheme in @graphemes("foobar")
- echo $grapheme
- end
- echo '# ANCHOR_END: graphemes'
- echo '# ANCHOR: reverse'
- echo @reverse([1 2 3])
- echo @reverse(["a"])
- let foo = [1 2 3]
- echo @reverse(@foo)
- echo '# ANCHOR_END: reverse'
|