I have an attribute with a value of a list of numbers separated by commas. I would like for all the consecutive numbers in the list to get replaced by one dash in between the first and last consecutive number instead of having each number represented. Basically I would like this "1,2,3,4,5,7,9,14,15" to become this "1-5,7,9,14-15".
Question
How to replace consecutive numbers in an attribute list from "1,2,3,4,7,10,13,14,15,16" to "1-4,7,10,13,14-16"?
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.