TABLE OF CONTENTS


::pwtk::type::rangestring

SYNOPSIS

proc ::pwtk::type::rangestring {value} {

PURPOSE

Check if a 'value' is a rangestring, where rangestring is a string having the syntax allowed by ::pwtk::parseRangeString (e.g. value = {1 2 5-})

ARGUMENT

RETURN VALUE

SOURCE

    # checking based on ::pwtk::parseRangeString
    set value [regsub -all {(begin|first|1st)} [::pwtk::normalizeRangeString_ $value] 1]
    set value [regsub -all {(end|last)} $value 1000]; # replaced with a big integer

    foreach item $value {
        if { ! [regexp {^[0-9]+-?[0-9]*$} $item] && ! [regexp {^-?[0-9]*$} $item] } {
            return 0
        }
    }
    return 1
}