The C# newbie has another simple question!
Does C# have built-in support for parsing strings of page numbers? By page numbers, I mean the format you might enter into a print dialog that's a mixture of comma and dash-delimited.
Something like this:
1,3,5-10,12
What would be really nice is a solution that gave me back some kind of list of all page numbers represented by the string. In the above example, getting a list back like this would be nice:
1,3,5,6,7,8,9,10,12
I just want to avoid rolling my own if there's an easy way to do it.
Edit
Thanks everyone.
I liked the format of Keith's answer the best but his code had one small mistake which is correct in kronoz's code.
That would be this:
Enumerable.Range(startPage, endPage - startPage + 1)
From the msdn page, Enumerable.Range takes the start of the range and the count (eg number of items in the range), not the actual ending value.