[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pad a string
- From: Craig Barnes <craigbarnes85@...>
- Date: Thu, 18 Apr 2013 14:27:33 +0100
On 18 April 2013 13:15, Chris Datfung <chris.datfung@gmail.com> wrote:
>
> Hi,
>
> I want to pad a string with itself n number of times, for example if n = 3 and var="test" then var = var .. var .. var
>
> I tried with a for loop but get one too many combinations
>
> > a="k"
> > n=3
> > for c = 1, n-1 do a = a..a end
> > print(a)
> kkkk
>
> Is there a smarter way to implement this?
>
print(string.rep("k", 3))