Right2(string, length)
Last updated February 24, 2002
Version: 1 | Requires: CF5 | Library: StrLib
Description:
Parameters are the same as right().
0 Length returns no value. Negative lengths will return the the full string minus the specified number of characters from the left.
Return Values:
Returns a string.
Example:
<cfoutput>
right2( "CFlib.org", 0 ) = #right2( "CFlib.org", 0 )#<br>
right2( "CFlib.org", 3 ) = #right2( "CFlib.org", 3 )#<br>
right2( "CFlib.org", -2 ) = #right2( "CFlib.org", -2 )#<br>
</cfoutput>
Parameters:
Name | Description | Required |
---|---|---|
string | The string to modify. | Yes |
length | The length to use. | Yes |
Full UDF Source:
/**
* Adds zero and negative support to the length parameter of right().
*
* @param string The string to modify.
* @param length The length to use.
* @return Returns a string.
* @author Jordan Clark (JordanClark@Telus.net)
* @version 1, February 24, 2002
*/
function right2( string, length )
{
if( length GT 0 )
return right( string, length );
else if( length LT 0 )
return right( string, len( string ) + length );
else return "";
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016