Skip to content

RepeatFirstDigit

Based on Extensible Algorithm Framework

This algorithm masks the "+4" component of a zip code by repeating its first digit four times, unless the first digit is zero, in which case '1' is repeated four times.

The input must contain a 4-character string "DDDD" (where each 'D' is a numeric digit). The following formats are valid inputs:

  • 4-character string "DDDD" where 'D' is a digit
  • 9-character string "cccccDDDD" where 'D' is a digit, and 'c' can be any character
  • 10-character string "ccccccDDDD" where 'D' is a digit, and 'c' can be any character but must contain at least one hyphen or period
  • 14-character string "cccccDDDDccccc" where 'D' is a digit, and 'c' can be any character

Info

14-character "cccccDDDDccccc" inputs will be truncated to "cccccDDDD"

For example:

  • "6912" → "6666"
  • "0123" → "1111"
  • "941173564" → "941173333"
  • "43556-9703" → "43556-9999"
  • "009078377 SJPR" → "009078888"

Note

This algorithm may generate non-conformant data events.