I have created a function that accepts two comma separated text strings sNew and sExisting- I put both csv strings into an array then I check sNew against sExisting to see if any of the sNew are contained in sExisting. If so, I remove the sNew value from sExisting.
The problem I'm running into is this:
If sNew = "2,56,734"
And sExisting = "1,2,56,734,5009"
the resulting string is "1,,,,5009"
I want to return "1,5009". How do I remove the extra commas, taking into account that I won't know how many there will be at any given point? Here's essentially what I want to do in plain language:
If I have > 1 comma next to each other, replace it with a single comma.
Any suggestions?
The problem I'm running into is this:
If sNew = "2,56,734"
And sExisting = "1,2,56,734,5009"
the resulting string is "1,,,,5009"
I want to return "1,5009". How do I remove the extra commas, taking into account that I won't know how many there will be at any given point? Here's essentially what I want to do in plain language:
If I have > 1 comma next to each other, replace it with a single comma.
Any suggestions?