Call too all one-liners !

Klaus Major klaus at major-k.de
Sat Jun 28 06:30:44 EDT 2008


Hi Sarah,

> On Sat, Jun 28, 2008 at 7:25 PM, Francis Nugent Dixon
> <effendi at wanadoo.fr> wrote:
>> Hi from Paris,
>>
>> You guys have always spoofed me with what you can do with
>> Transcript. Some of your coding makes me look silly.
>> I obviously don't "grab" Transcript like you do !
>> So I have a little test for you. I want to :
>> 1 -add
>> 2 -remove
>> a ".jpg" suffix from a file name that I'm holding in a variable.
>> Have you got a couple of one-liners to do that ?
>
> 1. add .jpg if it isn't already there
>   if char -4 to -1 of tFilename <> ".jpg" then put ".jpg" after  
> tFileName
> 2. remove .jpg if it's there
>   replace ".jpg" with empty in tFileName
> Or to remove any file extension (sorry, a two-liner)

No problem, just add a semicolon, et voila: a one-liner :-)

set the itemDel to "."; delete last item of tFileName

> I'm sure other people will come up with many alternatives - that's the
> fabulous thing about Revolution.
>
> Cheers,
> Sarah

Best

Klaus Major
klaus at major-k.de
http://www.major-k.de





More information about the use-livecode mailing list