Padding

Padding

Pads the value generated by another generator to a fixed length field. Either specify a sub-generator or run another generator using a Sequential before this one to provide a string suitable to being formatted.

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
size Content type: Integer
Final size of value. If the sub-generator of this generator produced a string shorter than the specified size, the value will be padded with the characters as specified in 'character'. If the generated value is too long, it will be truncated to the specified 'size'.
Default: <not set> (use size of parent field)
no 0 1
padToLeft Content type: Boolean
If this is true, fields are padded to the left, else to the right.
Default: false
no 0 1
  • true
  • false
  • 0
  • 1
character Content type: Character
Sets the character this generator uses for padding fields.
Default: ' '
no 0 1
gen Value Generator for this field no 0 1

Examples

  1. Pad to Right with #'s

    Pads the output of the RandomString generator with hash signs ('#') to the right.

    Schema config for Pad to Right with #'s
    <?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="PADDING">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--Pad to Right with #'s-->
          <!--Pads the output of the RandomString generator with hash signs ('#') to the right.-->
          <field name="pad_with_hashes_right" size="" type="VARCHAR">
            <gen_Padding>
              <size>8</size>
              <character>#</character>
              <gen_RandomString>
                <min>4</min>
                <max>6</max>
              </gen_RandomString>
            </gen_Padding>
          </field>
          </table>
    </schema>
    
    Output for Pad to Right with #'s
    Ns0Vm###
    G0ql0N##
    EYoGh###
    MWIvxI##
    kns7####
    NTHg####
    4zUKE0##
    BFEs####
    3XKf####
    oshVv###
  2. Pad to Left with #'s

    Pads the output of the RandomString generator with hash signs ('#') to the left.

    Schema config for Pad to Left with #'s
    <?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="PADDING">
        <!-- if tables should scale with -SF command line argument.
             Specify your scaling formula here: -->
        <size>10 * ${SF}</size>
    
        <!--Pad to Left with #'s-->
          <!--Pads the output of the RandomString generator with hash signs ('#') to the left.-->
          <field name="pad_with_hashes_let" size="" type="VARCHAR">
            <gen_Padding>
              <size>8</size>
              <character>#</character>
              <padToLeft>true</padToLeft>
              <gen_RandomString>
                <min>4</min>
                <max>6</max>
              </gen_RandomString>
            </gen_Padding>
          </field>
          </table>
    </schema>
    
    Output for Pad to Left with #'s
    ##a9hGk3
    ###i4tQn
    ###WSsbI
    ###Q86Es
    ##nC7i9m
    ##1DaVZU
    ##nHa21r
    ####Xc7v
    ###yed2L
    ##1P8cIr
2.7-83fb0 | 2020-04-22