MaskString

MaskString

Applies a mask to a string generated by a subgenerator.

Attributes
Name Description Required Min Max Allowed Values
name (Class)Name of this element. Used to identify plugin Class. Full name is required. Example: com.en.myPluginPackage.myPuginClass no 0 1
id Identification String of this element. May be used to uniquely identify a field within the children of an Element. no 0 1
Nodes
Name Description Required Min Max Allowed Values
mask Mask to be applied to a string generated by a sub generator.
# Any valid number, uses Character.isDigit.
' Escape character, used to escape any of the special formatting characters.
U Any character (Character.isLetter). All lowercase letters are mapped to upper case.
L Any character (Character.isLetter). All upper case letters are mapped to lower case.
A Any character or number (Character.isLetter or Character.isDigit)
? Any character (Character.isLetter).
* Anything.
H Any hex character (0-9, a-f or A-F).
Example: input "abcdefghi" with mask "(***)-***-***" would produce: "(abc)-def-ghi"
yes 1 1
gen Value Generator for this field yes 1 1

Example

  1. String Mask

    Generates random string of length 9 with the alphabet 'a,b,c,d,e' and applies a mask to that string. The string is split into the triples. The first triple is uppercased and surrounded by parentheses, all triples are divided by ' - '.

    Schema config for String Mask
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <!--
    /*******************************************************************************
    * Copyright (c) 2013, bankmark and/or its affiliates. All rights reserved.
    * bankmark UG PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
    ******************************************************************************/
    --><schema xmlns:doc="http://bankmark.de/pdgf/doc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="demo" xsi:noNamespaceSchemaLocation="structure/pdgfSchema.xsd">
      <!-- All data is derived from this starting seed.
           If this seed is the same, the generated data will the same on each
           computer/node/platform.
           Change this seed to generate a different data set.-->
      <seed>1234567890L</seed>
    
      <rng name="PdgfDefaultRandom"/>
    
      <!--Default Scale factor for all tables -->
      <property name="SF" type="double">1</property>
    
      <table name="MASK_STRING">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--String Mask-->
          <!--
            Generates random string of length 9 with the alphabet 'a,b,c,d,e' and applies a mask to that string. The string
            is split into the triples. The first triple is uppercased and surrounded by parentheses, all triples are divided
            by ' - '.
          -->
          <field name="masked_string" size="" type="NUMERIC">
            <gen_MaskString>
              <mask>(UUU) - *** - ***</mask>
              <gen_RandomString>
                <characters>abcde</characters>
                <min>9</min>
                <max>9</max>
              </gen_RandomString>
            </gen_MaskString>
          </field>
          </table>
    </schema>
    
    Output for String Mask
    (BAB) - acc - eea
    (ABE) - ebd - eea
    (CEC) - cee - cee
    (EBD) - aeb - dbb
    (ECC) - adb - baa
    (EEE) - cad - dde
    (DBB) - add - aea
    (ACE) - bca - ebe
    (DEA) - bdc - cda
    (DAB) - aec - dcb
2.7-83fb0 | 2020-04-22