RenderUtils - rife2/rife2-template-renderers GitHub Wiki

Most of the functionalities of this project's renderers are implemented in the rife.render.RenderUtils class.

Methods

Method Description
abbreviate Abbreviates a String to the given length using a replacement marker
beatTime Returns the Swatch Internet (.beat) Time for the give date-time
enodeJs Encodes a String to JavaScript/ECMAScript
fetchUrl Fetches the content (body) of a URL
formatCreditCard Returns the last 4 digits a credit card number. The number must satisfy the Luhn algorithm. Non-digits are stripped from the number
htmlEntities Converts a text string to HTML decimal entities
mask Masks characters in a String
normalize Normalizes a String for inclusion in a URL path
plural Returns the plural form of a word, if count > 1
qrCode Generates an SVG QR Code from the given String using goQR.me
rot13 Translates a String to/from ROT13
shortenUrl Shortens a URL using is.gd. The URL string must be a valid http or https URL
swapCase Swaps the case of a String
uptime Returns the formatted server uptime
validateCreditCard Validates a credit card number using the Luhn algorithm

Additional methods are provided directly by the rife.tools.StringUtils class

Formatters

There are also date/time formatters for popular formats:

DateTimeFormatter Description
ISO_8601_DATE_FORMATTER ISO 8601 date formatter
ISO_8601_FORMATTER ISO 8601 date and time formatter
ISO_8601_TIME_FORMATTER ISO 8601 time formatter
ISO_8601_YEAR_FORMATTER ISO 8601 Year formatter
RFC_2822_FORMATTER RFC 2822 date and time formatter