MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: integer to string??

  • To: mathgroup at
  • Subject: [mg30953] Re: [mg30940] integer to string??
  • From: BobHanlon at
  • Date: Fri, 28 Sep 2001 03:55:01 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

In a message dated 2001/9/27 2:20:09 AM, wzn at writes:

>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.

If, as in your case, the desired result is strings

Table["file"<>ToString[k], {k, 5}]

{"file1", "file2", "file3", 
  "file4", "file5"}

If the desired result is symbols (variables) then 
ToExpression[Table["file"<>ToString[k], {k, 5}]]

{file1, file2, file3, file4, file5}

Bob Hanlon
Chantilly, VA  USA

  • Prev by Date: Factorising operators??
  • Next by Date: Re: integer to string??
  • Previous by thread: Re: integer to string??
  • Next by thread: Re: integer to string??