Created
January 23, 2015 20:15
-
-
Save def-/1ed42da87b9e9b7343d5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| proc split_string(str): auto = | |
| result = iterator: string = | |
| var start = 0 | |
| for i in 0..str.high: | |
| if str[i] == ' ': | |
| yield str[start..i] | |
| start = i+1 | |
| yield str[start..str.high] | |
| var c = split_string("Hello World") | |
| for i in c(): | |
| echo i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment