Page Blocks

Hosting sponsored by:

Point In Space

 

API: Str

Filename:
fwpStr_getRight.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_getRight (Tag)

Description

Returns the rightmost N characters from specified string.

Syntax

[fwpStr_getRight: -str=string, -get=integer]

Parameters & Member Tags

-str - required : a string

-get - required : the length to be retrieved

Examples

[fwpStr_getRight: -str=(field:'invoiceNo'), -get='6']

Source Code

View in separate window

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

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

    {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 right 'len' chars of string 'str'. }

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

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

define_tag:'fwpStr_getRight', -priority='replace',
    -required='str',
    -required='get';

    local:
        'fw_get' = #get,
        'fw_str' = #str;

    if: #fw_get > #fw_str->size;
        #fw_get = #fw_str->size;
    /if;

    return:#fw_str->(substring:((#fw_str->size) - integer:#fw_get) + 1, integer:#fw_get);

/define_tag;
?>

© 2002-2012, pageblocks.org