parse number range

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gem46
    New Member
    • May 2010
    • 1

    #1

    parse number range

    how to find numbers entered in textbox that have a dash showing a range of numbers. UI enters numbers that can be anything. ie 1,2,5-10,55....etc.
    need to find the numbers between 5 and 10 and convert all numbers entered into a string
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    Looks like an Adobe printing page range selection clone.

    You'll have to write your own logic for that. There is no built-in control or .NET framework function for that.

    I would probably use string.split to break the one string into an array at the commas.
    Then check each array index for a hyphen
    If there is one, parse the text before the hyphen as 'from, and after the hypen as 'to', then add each number in between (in a loop maybe)

    Comment

    Working...