Skip to content

Instantly share code, notes, and snippets.

@def-
Created January 23, 2015 20:15
Show Gist options
  • Select an option

  • Save def-/1ed42da87b9e9b7343d5 to your computer and use it in GitHub Desktop.

Select an option

Save def-/1ed42da87b9e9b7343d5 to your computer and use it in GitHub Desktop.
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