repeating string
Devin Asay
devin_asay at byu.edu
Mon Feb 10 12:51:35 EST 2014
On Feb 8, 2014, at 10:41 PM, Geoff Canyon <gcanyon at gmail.com> wrote:
> On Wed, Feb 5, 2014 at 9:06 AM, Mike Kerner <MikeKerner at roadrunner.com>wrote:
>
>> put 30 "a" into goop, but that is a recipe for failure, and
>> put 30 "a"'s into goop is almost unreadable
>>
>
> If we're devising syntax, I think some other languages use * as in:
>
> put 30 * "a" into goop
>
> This still runs into problems because of LC's typeless variables:
>
> put 5 * 15 -- puts 75
> put 5 * "15" -- puts 1515151515
> put 15 into x
> put 5 * 15 -- puts 75
> put "15" into x
> put 5 * 15 -- still puts 75, nor should it change
>
> Perhaps "of"?
>
> put 5 of 15 -- puts 1515151515
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
Devin
Devin Asay
Office of Digital Humanities
Brigham Young University
More information about the use-livecode
mailing list