Making string of 2-d array in scala -


so have following in scala:

scala> val example = "hello \tmy \nname \tis \nmaria \tlee".split("\n").map(_.split("\\s+")) example: array[array[string]] = array(array(hello, my), array(name, is), array(maria, lee)) 

i want take each 1-d array , make string, , make array of these strings (strings should comma separated). how do this?

scala> example.map(_.mkstring) res0: array[string] = array(hellomy, nameis, marialee) 

to make strings comma separated:

scala> example.map(_.mkstring(",")) res0: array[string] = array(hello,my, name,is, maria,lee) 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -