Posted to tcl by kbk at Wed Jun 17 16:29:11 GMT 2009view raw

  1. proc isInRange {number ranges} {
  2. foreach r [split $ranges ,] {
  3. set bounds [split $r -]
  4. if {[llength $bounds] == 1} {lappend bounds [lindex $bounds 0]}
  5. if {$number >= [lindex $bounds 0] && $number <= [lindex $bounds 1]} {
  6. return 1
  7. }
  8. }
  9. return 0
  10. }