MathGroup Archive 2010

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

Search the Archive

Re: character repeat

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108355] Re: [mg108326] character repeat
  • From: Leonid Shifrin <lshifr at gmail.com>
  • Date: Mon, 15 Mar 2010 00:05:01 -0500 (EST)
  • References: <201003141012.FAA29622@smc.vnet.net>

Hi Chris,

In some languages "S" * n returns a string of n "S"s...
>
> is there a built in to do this in Mathematica - I can't find it in the
> docs..
>

To my knowledge, there isn't. But it is trivial to implement:

Clear[stringRepeat];
stringRepeat[s_String, n_Integer?Positive] :=
 StringJoin @@ Table[s, {n}]

In[1]:=
stringRepeat["S", 10]

Out[1]= "SSSSSSSSSS"


Regards,
Leonid



>
> Again, thanks
>
> Chris
>
>



  • Prev by Date: Re: Alternatives to ARPACK?
  • Next by Date: Butterworth filter
  • Previous by thread: character repeat
  • Next by thread: Re: character repeat