Re: How to "interpolate a string"
From: Bryan Oakley (oakley_at_bardo.clearlight.com)
Date: 10/05/04
- Next message: Ralf Fassel: "Re: How to "interpolate a string""
- Previous message: Sektor van Skijlen: "How to "interpolate a string""
- In reply to: Sektor van Skijlen: "How to "interpolate a string""
- Next in thread: Ralf Fassel: "Re: How to "interpolate a string""
- Reply: Ralf Fassel: "Re: How to "interpolate a string""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 05 Oct 2004 17:31:03 GMT
Sektor van Skijlen wrote:
> Sorry, maybe it's simple, but nothing comes to my mind :)
>
> Say, we have something like that
>
> set one 1
> set two 2
> set three 3
>
> set x {$one $two $three}
>
> and x contains $one $two $three
>
> how to make "1 2 3" using only the current value of x, in other words,
> to force appropriate substitutions on this expression?
>
>
The correct technique depends on whether you intend to create a list or
a string. To create a proper list no matter what the contents of one,
two and three, do:
set x [list $one $two $three]
To create a string you can do this:
set x "$one $two $three"
For a small subset of all possible values of one, two and three, the two
approaches will produce seemingly identical results. For many real-world
values the two will give different but equally useful results (equally
useful in different contexts, that is).
- Next message: Ralf Fassel: "Re: How to "interpolate a string""
- Previous message: Sektor van Skijlen: "How to "interpolate a string""
- In reply to: Sektor van Skijlen: "How to "interpolate a string""
- Next in thread: Ralf Fassel: "Re: How to "interpolate a string""
- Reply: Ralf Fassel: "Re: How to "interpolate a string""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|