Page Blocks

Hosting sponsored by:

Point In Space

 

API: Str

Filename:
fwpStr_maskRight.ctag

Released With:
5.0.0

Current Version:
1.0.0

Status: Active

Min Lasso Tested: 8.1.0

Max Lasso Tested: 8.5.3

Related:

Still don't get it?

Check out the talk list archives, or join and ask your questions.

Documentation Error or Request?

Email documentation corrections or comments

API Reference

fwpStr_maskRight (Tag)

Description

Uses a string value as a base mask, then overlays another string value right justified over the mask string. Useful for generating strings like ORDR-0000463 where the mask was ORDR-0000000 and the overlay was 463.

Syntax

[fwpStr_maskRight: -mask=string, -overlay=string]

Parameters & Member Tags

-mask - required : the base string which determines the length and format of the result string.

-overlay - required : the string which contains the unique value to be represented in the final result.

Examples

[fwpStr_maskRight: -mask='ORDR-000000', -overlay=$orderID]

Source Code

View in separate window

<?lassoscript
//............................................................................
//
//    pageblocks: (c) 2002-2007 http://www.pageblocks.org/
//
//............................................................................
/*

    {fileName=        fwpStr_maskRight.ctag }
    {rsrcType=        tag }
    {rsrcName=        fwpStr_maskRight }
    {rsrcHTTP=        www.pageblocks.org/refc/fwpStr_maskRight }

    {lassoVrsnMin=    8.1.0 }
    {lassoVrsnMax=    8.5.3 }

    {author=        Greg Willits }
    {authorEmail=    subscribe to pbTalk at www.pageblocks.org/talk/ }
    {authorHTTP=    www.pageblocks.org }

    {desc=            This tag returns the string 'mask' with the string 
                    'overlay' replacing the right characters of 'mask'. }

    {maintvsrn=        1.0 }
    {maintrelease=    5.0.0 }
    {maintdate=        2006-01-16 }
    {maintauthor=    Greg Willits }
    {maintnotes=    initial release - replaces fwpUtil_stringMaskRight }

*/
//.............................................................................

define_tag:'fwpStr_maskRight', -priority='replace',
    -required='mask',
    -required='overlay';
    return:(#mask->(subString: 1, #mask->size - (string:#overlay)->size)) + string:#overlay;
/define_tag;
?>

© 2002-2012, pageblocks.org