I have a case class like below:
case class EmployeeJobDataFields( empID: String,firstName: String,lastName:
String,fullName: String)
And I have a data like this
EmployeeJobDataFields("1043855", "Test", "User", "Test User")
To convert and obtain single string with pipe separator as shown below
employee.productIterator.mkString("|")
// val res0: String = 1043855|Test|User|Test User
To convert string into a Array[String], I did split with pipe separator as shown below
employee.productIterator.mkString("|").split("|")
I am expecting output as an array of strings like: Array(1043855, Test, User, Test User),
upon splitting I am getting output as shown below:
Array("1", "0", "4", "3", "8", "5", "5", "|", "T", "e", "s", "t", "|", "U", "s", "e", "r", "|"....)