|
Posted by Bryan Oakley on 04/21/06 20:57
comp.lang.tcl wrote:
>
> WOW! I would never have found that one, you are truly one of the TCL
> gurus out there (you came highly recommended by those I know)
Thanks for the compliment but finding it took two minutes. I simply put
a print statement at the top of every loop, then tried a couple of very
obvious tests.
> this seemed to have fixed the problem (probably overkill but it was the
> best I could think up at the moment:
>
> while {[info exists wordlet] && [string length $wordlet] > 0 &&
> ![regexp -nocase {[a-z]} [string index $wordlet $beginIndx]]} {
> append nonWord [string index $wordlet $beginIndx]
> incr beginIndx
> }
Yeah, that definitely helps that particular problem but it doesn't fix
all problems in the code.
Since you seem new to programming, you might want to look at tcltest.
Once you are up to speed on it (which doesn't take long), it would take
about 5-10 minutes to craft a couple dozen tests to validate the proc
against a whole range of inputs. That would have uncovered many bugs.
http://mini.net/tcl/tcltest
--
Bryan Oakley
http://www.tclscripting.com
Navigation:
[Reply to this message]
|