1. DottedText

    Article: AN0001623Updated: 17.10.2018

    This object converts text with numeric signs e.g. "1.5.14.3" into a whole number. This helps for an easy comparison or ordering of version numbers. The object is used e.g. in model EasyTask at the class Version.

    When converting take care of not overflowing data type int or long.

    Conversion takes care of various number of digits in the text with numbers.

     

    Name Description
    char Separator Separator between number positions. Default value is ".".
    int MinNumbers Minimal number of number positions.  Default value is 0.
    int MaxNumber Maximal number of number positions.  Default value is 0.
    int MaxNumberLength Maximal number of digits in a single number position.  Default value is 3.
    int Parse(string text) Function performs parsing of the input text.
    long ParseLong(string text) Function performs parsing of the input text.

    If MinNumbers or MaxNumbers is equal to 0, is this property ignored.

    Example

    When creating an instance, you define a separator of number positions, minimal and maximal number of number positions and maximal number of digits in a single positon.

    DottedText dt = new DottedText( 4, 4, 3);
    var i = dt.ParseLong("1.718.4.88");
    //result: i = 100 718 400 880

    DottedText dt = new DottedText( 3, 3, 2);
    var i = dt.Parse("1.71.4");
    //result: i = 107 140

×