SPLIT text statement
- Loading...
Created by: dvkt
This is much nicer than #93. This patch implements the SPLIT
statement that was already listed as a TODO
in the source. It lets you easily just split a string or file into a vector and loop over that, and avoids all the caching nonsense.
DATA:
words is text vector
PROCEDURE:
SPLIT "hi there" BY " " IN words
DISPLAY words:1 crlf
output:
there
If you want to get all the characters, you can split by ""
:
SPLIT "hi there" BY "" IN letters
DISPLAY letters:1 crlf
output:
i
And of course, the whole point - it works with utf8:
split "🐈 say meow, 🐕 say woof" by "" in letters
display letters:0 crlf
display letters:6 letters:7 letters:8 letters:9 crlf
display letters:12 crlf
output:
🐈
meow
🐕
- You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply