Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scan problem

Status
Not open for further replies.

empty84

Programmer
Dec 8, 2006
6
PL
i'm beginer in tcl and i have a data in format like this:

"symbol",0.00,"12/12/2006","2:03pm",0.00,0.00,0.00,0.00,0.00

so it goes like this:

"string",real,"string","string",real,real,real,real,integer

i want to get this data to nine variables. i'm tryn' to do it by command scan but this is not working good. i've wrote something like this:

scan $data ^("%s",)%f(,")%s(",)"%s"(,)%s(,)%f(,)%f(,)%f(,)%d symbol value data time v1 v2 v3 v4 volume

anyone who can help me with this?

 
how can i scan data from line:

"var","var",var

?

scan "var","var",var "%f","%f",%f a b c?
 
thank you this may be helpful. anyone with expierience with using scan ?
 
Maybe this can help you:

set string {"a string",real,"string","string",real,real,real,real,integer}
set list [split $string ,]
foreach item $list { puts [string trim $item \"] }

The main command is [string trim $item \"] that trim the " char in front and at end of the item (and does nothing if there is none).

More info here:
Hope to help

ulis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top