Skip to content

Instantly share code, notes, and snippets.

@blouerat
Created May 25, 2011 22:39
Show Gist options
  • Save blouerat/992161 to your computer and use it in GitHub Desktop.
Save blouerat/992161 to your computer and use it in GitHub Desktop.
A scala implementation of this https://github.com/schatteleyn/Convertor
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", "$"))
@blouerat
Copy link
Author

Conding functions in one line was just a challenge for fun ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment