I tried to convert a scala string to array by splitting it by
var string = "a,b,c,d," array = string.split(",") arr: Array[String] = Array(a, b, c, d)
But the output I am getting is
Array(a, b, c, d), instead of
Array(a, b, c, d, ). The last comma in the string is ignored by the split method. Is there any other method to solve this problem?.I presume this is trivial one, but I am new to scala. Help!