String is ex=\"test1, test2, test3, test4, test5\"
ex=\"test1, test2, test3, test4, test5\"
when I use
ex.split(\",\").first
it returns
\"test1\"
Try split(",")[i] where i is the index in result array. split gives array below
split(",")[i]
i
split
["test1", " test2", " test3", " test4", " test5"]
whose element can be accessed by index.