Turning number ranges into prefixes

David Cantrell david at cantrell.org.uk
Wed Aug 23 14:34:39 BST 2006

I have a little problem that I could do with some help with.  I have
data specifying number ranges.  For example, 1424210000 - 1424225999.  I
need to turn that into a list of prefixes like 142421, 1424220, 1424221,
1424222, 1424223, 1424224, 1424225.  That range includes all the numbers
of the right length with those prefixes, and no others.  Is there a
terribly clever way of generating the list?

If it makes things easier, the length is actually irrelevant - these are
phone numbers, so 14242221 is impossible, it has to be 1424222XXX.

David Cantrell | Hero of the Information Age

More information about the london.pm mailing list