Kotlin String.split, ignore when delimiter is inside a quote
Answer #1 100 %You can use regex
in split method
According to this answer the following regex only matches ,
outside of the "
mark
,(?=(?:[^\"]\"[^\"]\")[^\"]$)
so try this code:
str.split(",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*\$)".toRegex())