I have a string that can range from the empty string to an arbitrary list of comma delimited numbers. For example: "1,2,3"
Unfortunately as I write the code to remove an element I have a bunch of if statements--mainly to deal if it is the first, last, or only element in the list. I keep thinking there has got to be a better way!
For example, I would need to be able to remove the element '2
' in the following lists:
"1,2,3"
"1,3,2"
"2,1,3"
"2"
"12,2,21"
""