Last active
February 12, 2017 04:17
-
-
Save rubikill/3210957071fa19091761df6ad5e2dcf3 to your computer and use it in GitHub Desktop.
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
defmodule App do | |
def split_case(str) do | |
str | |
|> String.split("") | |
|> Enum.reduce({"", ""}, fn(x, {a, b})-> | |
cond do | |
"A" <= x and x <= "Z" -> {a <> x, b} | |
"a" <= x and x <= "z" -> {a, b <> x} | |
true -> {a, b} | |
end | |
end) | |
end | |
end | |
App.split_case("Hello World") |
Author
rubikill
commented
Feb 12, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment