For Programmers: Free Programming Magazines  


Home > Archive > Tcl > October 2005 > string first









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author string first
Mark Hobley

2005-10-22, 6:58 pm

#! /bin/tclsh
set char(cmdswitchseparator) ":"
set separatorposition -1
set argstr "balls:dammit"
set separatorposition [string first $char(cmdswitchseparator), $argstr]
puts $separatorposition

I expected this to output the position of the colon, but I just get -1.

What is wrong ?

Please advise.

Regards,

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/

Darren New

2005-10-22, 6:58 pm

Mark Hobley wrote:
> set separatorposition [string first $char(cmdswitchseparator), $argstr]
> What is wrong ?


Arguments in Tcl are not separated by commas.

set separatorposition [string first $char(cmdswitchseparator) $argstr]


--
Darren New / San Diego, CA, USA (PST)
Neither rocks nor slush nor salted rims
shall keep us from our appointed rounds.
Mark Hobley

2005-10-22, 6:58 pm

Darren New <dnew@san.rr.com> wrote:
> Mark Hobley wrote:
>
> Arguments in Tcl are not separated by commas.
>


Duh ! What a donkey I am !

Cheers.

Mark.

--
Mark Hobley
393 Quinton Road West
QUINTON
Birmingham
B32 1QE

Telephone: (0121) 247 1596
International: 0044 121 247 1596

Email: markhobley at hotpop dot donottypethisbit com

http://markhobley.yi.org/

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com