Prev: visible and invisible button
Next: applescript
From: davo on 14 Mar 2010 06:11 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.. Again, thanks Chris
From: Bill Rowe on 15 Mar 2010 01:07 On 3/14/10 at 5:12 AM, the.wright.email(a)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
From: Leonid Shifrin on 15 Mar 2010 01:08 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 > >
From: dh on 15 Mar 2010 06:03 function to the use simplier. E.g a "a" followed by 10 "b"'s: On 14.03.2010 11:11, davo wrote: E-Mail:<mailto:dh(a)metrohm.com> Internet:<http://www.metrohm.com>
|
Pages: 1 Prev: visible and invisible button Next: applescript |