Tagged Questions
5
votes
3answers
271 views
Scala: a safer way to cut string
I want to get just the first line of a big string. Currently, here's how I do it:
def getFirstParagraph(txt: String) = {
val newLineIdx = txt.indexOf("\n") match {
case i: Int if i > 0 ...