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
- value --- the value to check
RETURN VALUE
- 1 if number is of correct type
- 0 otherwise
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 }