Sunday 14 June 2009

String parsing thru lists

Filter numbers from strings.

println( "there are 7 numbers 8 in 2 here"
.toList.filter(Character.isDigit) )


Load the first word only.

println(("first word only".toList.takeWhile(c => c != ' ') ).mkString)

No comments:

Post a Comment