I'm having a string which is delimited by comma such as:
- if the value is an integer then comma integer value comma (ex:
,10,
) - if the value is a date/string then comma double cotes string/date double cotes comma (ex:
,"myStringValue",
)
The issue is at some point some where i'm expecting to find a string using the above logic i may have anoter comma e.g: comma double cotes string comma string double cotes comma. (ex: ,"myStringValue, withCommaIssue",
)
Is there any way i can still split my inital string? Can I use a regex and the logic for it to be comma followed by double (,"
) cotes and the end of the string to be signaled only by double cotes comma (",
)? But for this case will the other substrings which are integers still work?
example:
1,20,20,,,"string to be parsed as string","01-jan-2020",,"string having an issue, maybe two",,,
In the example above I am able to split the string just fine in substring just that my issue is with the element at position 9 out of 12 possible elements ("string having an issue, maybe two"
). Also all integer values are not having double cotes and the elements with no value are present as well.
Many thanks,