MathGroup Archive 2010

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

Search the Archive

Re: character repeat

  • To: mathgroup at smc.vnet.net
  • Subject: [mg108368] Re: character repeat
  • From: Bill Rowe <readnews at sbcglobal.net>
  • Date: Mon, 15 Mar 2010 00:07:26 -0500 (EST)

On 3/14/10 at 5:12 AM, the.wright.email at gmail.com (davo) wrote:

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

There is no built in function to do this as far as I know. But
it is a simple matter to create one. For example

In[6]:= strTimes[x_String, n_Integer] := Nest[# <> x &, "", n]

In[7]:= strTimes["S", 6]

Out[7]= SSSSSS

In[8]:= StringLength[%]

Out[8]= 6



  • Prev by Date: Butterworth filter
  • Next by Date: Equating real and imaginary part
  • Previous by thread: Re: character repeat
  • Next by thread: Re: character repeat