MathGroup Archive 2009

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

Search the Archive

Re: Generating a list numnber in string format

  • To: mathgroup at smc.vnet.net
  • Subject: [mg102645] Re: [mg102598] Generating a list numnber in string format
  • From: Adriano Pascoletti <adriano.pascoletti at dimi.uniud.it>
  • Date: Mon, 17 Aug 2009 04:31:24 -0400 (EDT)
  • References: <200908161040.GAA01235@smc.vnet.net>

ToString solves your problem


In[1]:= n = 6; binlist = ToString /@ Range[n]
binnames = (StringJoin["bin", #1] & ) /@ binlist
Out[1]= {"1", "2", "3", "4", "5", "6"}
Out[2]= {"bin1", "bin2", "bin3", "bin4", "bin5", "bin6"}


or


In[3]:= binnames1 = (StringJoin["bin", ToString[#1]] & ) /@ Range[n]
Out[3]= {"bin1", "bin2", "bin3", "bin4", "bin5", "bin6"}



In[4]:= binnames1 === binnames
Out[4]= True



Adriano Pascoletti

2009/8/16 Richard Trilling <rich.bis at wanadoo.fr>

> Hello,
>
> I would like to be able generate a list of numbers from 1 to n string
> format.
>
> binlist={"1","2","3","4",..."n"}
>
> I need to use them in this format to map into a list of variable names
>
> binnames = Map["bin" <> # &, binlist]
>
>


  • Prev by Date: Re: Do-command
  • Next by Date: Re: Is it possible with Mathematica?big problem.thank you
  • Previous by thread: Re: Generating a list numnber in string format
  • Next by thread: Re: Generating a list numnber in string format