Reputation: 1911
Given:
val foo = "123456"
val bar = "24"
Now make diffs of this strings:
foo diff bar
// String = 1356
This returns the differences as concatenated String. Is it possible to get a List of the diffs? Something like:
foo magicDiff bar
// List[String] = List("1", "3", "56")
Upvotes: 2
Views: 91
Reputation: 24812
scala> foo.split(bar.toArray).toList.filterNot(_.isEmpty)
res0: List[String] = List(1, 3, 56)
Upvotes: 2