I have a requirement where i have 2 string like below
val data1 = ("42881644070,13.04148,80.096043,32,2019-05-01 12:32:00,[32435381]#42881685433,13.057927,80.127096,45,2019-05-01 12:32:00,[32435383]#42881685434,13.057927,80.127096,35,2019-05-01 12:32:00,[32435384]")
val data2 = ("42881644070#43848058544#43847944680#43849252675#43849251662#43849943435#43850472762")
I wanted to compare data 2 values to data1 1st item which is id and seperator between item is # here.Also the output should be only the items which is not matching with data2.
Here the output should be Array[String]
Array(42881685433,13.057927,80.127096,45,2019-05-01 12:32:00,[32435383], 42881685434,13.057927,80.127096,35,2019-05-01 12:32:00,[32435384])
data1.split("#").flatMap(_.split(",").filter {_.intersect(data2_splt).isEmpty})But it is wrong its not filtering