This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

uncomment a *

Help for those learning Tcl or writing their own scripts.
Post Reply
k
keeper2
Voice
Posts: 12
Joined: Wed Jul 19, 2006 10:16 am

uncomment a *

Post by keeper2 »

OK I have the following

set oper [lindex [split $arg " "] 6]
if {[string match "*" $oper]} {
...
}

So my problem is now I want to test if the * isin the variable oper, but so it get interpreted as any character.
User avatar
krimson
Halfop
Posts: 86
Joined: Wed Apr 19, 2006 8:12 am

Post by krimson »

so you want to check if '*' is anywhere in your string? or only at the beginning?

Code: Select all

if {[string first * $oper 0] >0} {
  #this will check if there's at least one '*' in $oper
}
k
keeper2
Voice
Posts: 12
Joined: Wed Jul 19, 2006 10:16 am

Post by keeper2 »

krimson wrote:so you want to check if '*' is anywhere in your string? or only at the beginning?

Code: Select all

if {[string first * $oper 0] >0} {
  #this will check if there's at least one '*' in $oper
}
seems not to work. I want to test if in the variable $oper is no '*'.

if {![string first * $oper 0] >0} {
#this will check if there's at least no '*' in $oper
}

^^that doesnt't work :(
k
keeper2
Voice
Posts: 12
Joined: Wed Jul 19, 2006 10:16 am

Post by keeper2 »

if {[string first * $oper 0] < 0} {
#this will check if there's at least no '*' in $oper
}

OK have it :)
Thanks for help!
User avatar
krimson
Halfop
Posts: 86
Joined: Wed Apr 19, 2006 8:12 am

Post by krimson »

i misinterpreted your request.. my bad :roll:
Post Reply