NumberRange Class

Represents a range of numbers.

Definition

Namespace: GleamTech.DocumentUltimate
Assembly: GleamTech.DocumentUltimate (in GleamTech.DocumentUltimate.dll) Version: 7.1.5
C#
public abstract class NumberRange
Inheritance
Object    NumberRange
Derived

Remarks

The range is specified as a string in the following forms or combination thereof:

5single value
1,2,3,4,5sequence of values
1-5closed range
-5open range (converted to a sequence from 1 to 5)
1-open range (converted to a sequence from 1 to final number)
allkeyword representing all numbers.
oddkeyword representing odd numbers.
evenkeyword representing even numbers.

The value delimiter can be either ',' or ';' and the range separator can be either '-' or ':'. Whitespace is permitted at any point in the input.

Any elements of the sequence that contain non-digit, non-whitespace, or non-separator characters or that are empty are ignored.

Constructors

NumberRange Initializes a new instance of the NumberRange class from the specified string.

Methods

Add(Int32)Adds a single number to the sequence.
Add(String)Adds a range of numbers to the sequence from a string representation (e.g. 1-5, 8, 11-13).
Add(NullableInt32, NullableInt32)Adds a range of numbers to the sequence. Reverse ordering is accepted.
Contains Determines whether this instance contains the specified range part (number range or keyword).
EnumerateEnumerates all the numbers that this range instance describes. The sequence will be distinct and in ascending order.
ExpandKeyword Expands a supported keyword to an enumerable sequence of numbers. It can be overriden in derived classed to support additional keywords.
MatchKeyword Matches a supported keyword. It can be overriden in derived classed to support additional keywords.
ToStringConverts this instance to a string containing the range of numbers.
(Overrides ObjectToString)

See Also