Created
May 25, 2011 22:39
-
-
Save blouerat/992161 to your computer and use it in GitHub Desktop.
A scala implementation of this https://github.com/schatteleyn/Convertor
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
import java.util.regex.Pattern | |
def convert(in: String, delimiter: String) = in.split(Pattern.quote(delimiter)).toList.map(str => str.head.toUpper+str.tail).mkString(delimiter) | |
def convert(in: String):String = convert(in, "\n") | |
// Test with delimiter & without | |
println(convert("bli\nbla\nblu")) | |
println(convert("bli$bla$blu", "$")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Conding functions in one line was just a challenge for fun ;)