MathGroup Archive 2002

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

Search the Archive

Re: list of digits to string


In a message dated 4/8/02 4:51:10 AM, murraye at attbi.com writes:

>How do I convert a list of bits, say {0, 1, 1, 0, 0}, to a corresponding
>character string, "01100"?  Just for bits, the expression
>
>  StringJoin[lis /. {0 -> "0", 1 -> "1"}]
>
>does what I want.  But, more generally, how do I do the same with
>arbitrary digits?  The expression similar to the above but for all 9
>digits 0, 1, 2, ..., 9 seems overly long.  Is there an easier way?
>

lst = Table[Random[Integer, {0, 9}], {10}]

{0,3,3,8,6,7,2,7,6,3}

StringJoin[ToString/@lst]

0338672763


Bob Hanlon
Chantilly, VA  USA


  • Prev by Date: FullSimplify[Abs[Sign[x]],x>=0] equals 1?
  • Next by Date: Re: Plot inset?
  • Previous by thread: list of digits to string
  • Next by thread: Re: list of digits to string