repeating string
Alex Tweedly
alex at tweedly.net
Mon Feb 10 19:15:55 EST 2014
On 10/02/2014 17:51, Devin Asay wrote:
> Seems like the most LiveCode-like syntax would be something like:
>
> pad <container> with <string> at beginning|end|<chunk description> [for] N [times]
>
> So,
>
> pad myvar with space at beginning 4 times
>
> pad fld "foo" with 0 at end 10 times
>
> pad "hello" with "xyz" after char 3 for 2 times --> helxyzxyzlo
>
>
While I like the general idea, I don't think that's the *most* LC-like
syntax.
I don't see any need to invent a new verb "pad"; why not simply
something like
put <value> [for N times] <chunk description>
or
put [N copies of] <value> <chunk description>
Thus
put "hello" into myVar
put "xyz" for 2 times after char 3 of myVar --> helxyzxyzlo
or perhaps
put 2 copies of "xyz" after char 3 of myVar
Or indeed
put "abc" & 4 copies of " " & "def" into newVar
to give a value of "abc def"
-- Alex.
More information about the use-livecode
mailing list