Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

addEvery

elcapo edited this page Nov 4, 2014 · 3 revisions

addEvery Inserts a given character into a string every n positions.

Usage

/* MySQL */
SELECT addEvery( '00000000', '-', 2 ); /* Returns 00-00-00-00 */
/* JavaScript (independent function) */
return addEvery( '00000000', '-', 2 ); /* Returns 00-00-00-00 */

/* JavaScript (as a String method) */
return '00000000'.addEvery( '-', 2 ); /* Returns 00-00-00-00 */
/* PHP */
return addEvery( '00000000', '-', 2 ); /* Returns 00-00-00-00 */

Dependencies

This function is being used by external packages as Fields Good, in order to construct masks that make the user experience more confortable. For instance, its being used to insert a space every four characters when working with IBANs.

Category

This function is part of the [Common functions](Common functions) package.

SEPA validations

  • [International Bank Account Numbers (IBAN)](International Bank Account Numbers (IBAN))

Spanish validations

Helpers

  • [Common functions](Common functions)
Clone this wiki locally