Contraction of series of numbers
I'm sure I've seen this script somewhere in the forums, but I haven't managed to find it regardless of the search terms I use.
Basically I'm trying to contract a series of numbers into a span of numbers.
For example:
41, 42, 43, 44, 45
will become:
41-45
After that I will write a script to further reduce that to '41-5' as suitable for indexes.
Of course, this is more of a pure javascript problem than a pure InDesign problem since we are just dealing with a string, then converting to an array of numbers, then contraction. But I'm sure I found it here... anyway.
Any help with finding this script/thread is much appreciated.