RE: integer to string??
- To: mathgroup at smc.vnet.net
- Subject: [mg30960] RE: [mg30940] integer to string??
- From: "David Park" <djmp at earthlink.net>
- Date: Fri, 28 Sep 2001 03:55:09 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Richard,
This generates the desired strings as we can see by looking at the FullForm.
"file" <> ToString[#] & /@ Range[4]
% // FullForm
{"file1", "file2", "file3", "file4"}
List["file1", "file2", "file3", "file4"]
This generates the symbols.
Symbol["file" <> ToString[#]] & /@ Range[4]
% // FullForm
{file1, file2, file3, file4}
List[file1, file2, file3, file4]
Functional programming is generally much easier than procedural programming.
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
> From: Richard [mailto:wzn at jongnederland.nl]
To: mathgroup at smc.vnet.net
>
> Hi all,
>
> Is it possible to append an integer to a string? For example in a for-loop
> i'm trying to create the strings: file1, file2, file3, etc. How can I do
> this by appending a counter (i) to the string filee.
>
> Thanx !!,
> WJ
>