Am trying to detect strings with * (asterisks) in them to do (something)...
Have tied:
Code: Select all
if {[string match "{*\*}*" $tt]}
and
if {[string match "*\**" $tt]}
Cheers
Code: Select all
if {[string match "{*\*}*" $tt]}
and
if {[string match "*\**" $tt]}
Code: Select all
% set text "* bla bla * bla"
* foo
% string first * $text
0
% set text "bla bla * bla"
bla bla * bla
% string first * $text
8
Playing in partyline, I first did:NewzNZ wrote: ...
Am trying to detect strings with * (asterisks) in them to do (something)...
Have tied:
Code: Select all
if {[string match "{*\*}*" $tt]} ...
Code: Select all
.set testtext "bla bla * bla"
Code: Select all
<myhandle> .tcl string match {*\**} $testtext
<botnick> Tcl: 1
Code: Select all
<myhandle> .tcl string match {*\* *} $testtext
<botnick> Tcl: 1
<myhandle> .tcl string match {* \* *} $testtext
<botnick> Tcl: 1
<myhandle> .tcl string match {* \* *} $testtext
<botnick> Tcl: 0
<myhandle> .tcl string match {* \* *} $testtext
<botnick> Tcl: 1