I’ve got a string of zipcodes (which I can define myself) which I need as an array. I can do this the easy way by using the following input;
20,21,22,27,28,29,30,31,36,37,38,63,64,65,66,67,68,69,70,71,74,75,76,97,98,99
But what I would like to do is the following;
20,21,22-27,28-31,36-38,63-71,74-76,97-99
When using the input from the first example, I can create an array like this;
region_1_zipcodes.split(',');
But how is it possible to create an array with the same output, but using the second example.
I am free the use the input as I want; the example I provided isn’t leading. So if it’s better to change it into something else, it’s possible. The only requirement is that I’m using an inputfield (text) for adding the needed data.
The output should be like this;
['20', '21', '22', '27', '28', '29', '30', '31', '36', '37', '38', '63', '64', '65', '66', '67', '68', '69', '70', '71', '74', '75', '76', '97', '98', '99']