....to sort the following code so user input has to be at least 3 characters ?
i tried changing the if {[llength $arg] < 3} then { but that doesnt work.
proc qfind {nick host hand chan arg} {
if {[llength $arg] < 1} then {
putquick "NOTICE $nick : You might wanna put in a search word to limit the list a bit"
return
You're using llength. That counts the number of 'elements' in a list. (in this case the number of words). Using llength on raw user input is bad because whatever they input will be interpretted literally.
if you want to count the number of words, do this:
if {[llength [split $arg]] < 4} {
# put in less than four arguments.. fob them off
} else {
# they put in four or more arguments.. code to do whatever goes here
}
But that isn't even what you want. You want to count the number of characters he put in.
if {[string length $args] < 4} {
# they put in less than four characters.. bitch at them
} else {
# they put in four or more arguments.. code to do whatever goes here
}
Hope that helps.
Last edited by Iridium on Thu Aug 29, 2002 3:18 pm, edited 1 time in total.