public
anonymous / split.scala
Created

  • Download Gist
split.scala
Scala
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// Executed as a Scala script
// Scala version 2.10.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_01)
 
class Person(firstLast: String) {
val ss = firstLast.trim.split(" ")
println(ss.getClass.getName)
println(ss.length)
ss.zipWithIndex foreach println
}
 
new Person("John Doe")
// [Ljava.lang.String;
// 3
// (John,0)
// (,1)
// (Doe,2)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.