Last active
April 23, 2017 15:26
-
-
Save toomasv/90107dbf233e7f7bde16c59462305181 to your computer and use it in GitHub Desktop.
Break a block into pieces using the provided delimiter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Red [Author: "Toomas Vooglaid" | |
Adapted-from: "split" | |
Date: "2017-04-23" | |
Version: "0.1" | |
] | |
split-block: func [ | |
{Break a block into pieces using the provided delimiter} | |
series [block! hash!] dlm [string! char! bitset! any-word! any-block!] /local s num | |
][ | |
num: either any-block? dlm [length? dlm] [1] | |
dlm: either any-word? dlm [to-block to-lit-word dlm] [dlm] | |
parse series [collect any [copy s [to dlm | to end] keep (s) num skip]] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment