Skip to content

Instantly share code, notes, and snippets.

@Gustav-Simonsson
Created December 20, 2011 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gustav-Simonsson/1501602 to your computer and use it in GitHub Desktop.
Save Gustav-Simonsson/1501602 to your computer and use it in GitHub Desktop.
subs(String, Ints) ->
{Intervals, _} = lists:mapfoldl(fun(E, A) -> L = A + E, {{A, L - 1}, L} end, 1, Ints),
[string:sub_string(String, Start, Stop) || {Start, Stop} <- Intervals].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment