rife.render.FormatCreditCard - rife2/rife2-template-renderers GitHub Wiki

Formats a template credit card number value to the last 4 digits.

The number must satisfy the Luhn algorithm. Non-digits are stripped from the number.

Usage

<!--v render:rife.render.FormatCreditCard:valueId/-->
{{v render:rife.render.FormatCreditCard:valueId/}}

Sample

Template

Credit card ending in <!--v render:rife.render.FormatCreditCard:ccnumber/-->

Code

template.setAttribute("ccnumber","5130-3899-9169-8324");

Output

Credit card ending in 8324