repeating string

Devin Asay devin_asay at byu.edu
Tue Feb 11 10:41:12 EST 2014


On Feb 10, 2014, at 5:15 PM, Alex Tweedly <alex at tweedly.net>
 wrote:

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


I like your suggestion, Alex. It makes sense to simply add capability to an existing command. I wonder whether the open language model will make it easy to support syntax enhancements like this?

Devin

Devin Asay
Office of Digital Humanities
Brigham Young University





More information about the use-livecode mailing list