This tag removes the last occurrence of a period followed by any number of characters from the end of a string. Used to isolate a filename from its extension.
Parameters
none
Sample Usage
pk_removeextension('this is my filename.jpg')
-> 'this is my filename'
pk_removeextension('this.is.my.filename.jpg')
-> 'this.is.my.filename'
pk_removeextension('this is my filename')
-> 'this is my filename'
Source Code
Click the "Download" button below to retrieve a copy of this tag,
including the complete documentation and sample usage shown
on this page. Place the downloaded ".inc" file in your
LassoStartup folder, restart Lasso, and you can begin using this
tag immediately.
if: !(lasso_tagexists: 'pk_removeextension');
define_tag:'removeextension', -namespace='pk_',
-required='filename',
-description='removes the last occurrence of a period followed by any number of characters from the end of a string';
local('output')=string;
if(local_defined('filename'));
local:'tempArray' = #filename -> split:'.';
if((#tempArray -> size) > 1);
#tempArray -> remove;
/if;
#output = (#tempArray -> join:'.');
/if;
return(#output);
/define_tag;
/if;