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.

question marks in strings

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
NewzNZ
Halfop
Posts: 68
Joined: Thu Mar 05, 2009 5:15 am
Contact:

question marks in strings

Post by NewzNZ »

Hi there

Am trying to single out question marks (?) in some of my strings...

Have tried:

if {[string match "*\?*" $string]} {

..but no luck...
Any ideas would be appreciated...cheers.
Last edited by NewzNZ on Tue Sep 24, 2019 4:26 am, edited 1 time in total.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: question marks in strings

Post by willyw »

NewzNZ wrote:Hi there
...
Have tried:

if {[string match "*\?*" $string]} {

..but no luck...
Any ideas would be appreciated...cheers.

Code: Select all

[string match {*\?*} $string]
or

Code: Select all

[string match "*\\?*" $string]
I'm sorry, I can't remember where I got that from, so I can't provide you with a reference.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
User avatar
NewzNZ
Halfop
Posts: 68
Joined: Thu Mar 05, 2009 5:15 am
Contact:

Post by NewzNZ »

Great will give that a try...thanks for the reply!
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What about string first ? $string?
Once the game is over, the king and the pawn go back in the same box.
User avatar
NewzNZ
Halfop
Posts: 68
Joined: Thu Mar 05, 2009 5:15 am
Contact:

Post by NewzNZ »

Thanks will try also! =)
Post Reply