ccEscape(ccnum)
Last updated April 26, 2009
Version: 2 | Requires: ColdFusion 5 | Library: StrLib
Description:
Escapes a credit card number, showing only the last 4 digits. The other digits are replaced with the * character.
Return Values:
Returns a string.
Example:
<cfoutput>#ccEscape(creditcard)#</cfoutput>
Parameters:
| Name | Description | Required |
|---|---|---|
| ccnum | Credit card number you want to escape. | Yes |
Full UDF Source:
<cfscript>
/**
* Escapes a credit card number, showing only the last 4 digits. The other digits are replaced with the * character.
* return just stars if str too short, found by Tony Monast
*
* @param ccnum Credit card number you want to escape. (Required)
* @return Returns a string.
* @author Joshua Miller (josh@joshuasmiller.com)
* @version 2, April 26, 2009
*/
function ccEscape(ccnum){
if(len(ccnum) lte 4) return "****";
return "#RepeatString("*",val(Len(ccnum)-4))##Right(ccnum,4)#";
}
</cfscript>
Search CFLib.org
Latest Additions
Ryan Thompson-Jewell added
ListSplit
2 day(s) ago
Nathan Dintenfass added
RowsToColumns
2 day(s) ago
Barney Boisvert added
indentXml
3 day(s) ago
Barney Boisvert added
REReplaceCallbac...
3 day(s) ago
Top Rated
FolderSize
Rated 5.0, 7 time(s)
UniqueValueList
Rated 5.0, 5 time(s)
QuickSort
Rated 5.0, 3 time(s)
ListDeleteDuplic...
Rated 5.0, 3 time(s)