Description

The StringRemoveGen is designed to remove a specific token from a referenced value and returns the modified result. You can remove all occurrences, the first occurrence only, or the last occurrence only. Some use case examples include removing: 

  • Hyphens from Account Numbers (e.g., ACCT-8900)
  • Hyphens from Phone Numbers (e.g., 800-897-1002)
  • Currency Symbol from a Dollar Amount (e.g., $45.00)
  • Special Characters (e.g., @, #, *)


In This Article


Generator Parameters

All parameters are required for the StringRemoveGen

  • reference* - A constant or referenced value (e.g., Attribute, Linked Generator) where values will be removed. 
  • valueToRemove* - Defines the value to remove within the referenced string. 
  • removalType*- Defines the type of removal that will occur. The options are the following: 
    • removeAll - remove all occurrences
    • removeFirst - remove first occurrence only
    • removeLast - remove last occurrence only


Example 1 - Remove Hyphen from Account Number

A tester wants to remove the hyphen from each account number. Examples of the original and modified string values are provided below:


This example will use two Linked Generators, but you can also reference an Attribute within the StringRemoveGen.

  • RangeConstantGen- Generates account numbers that increase by 1 with this format: ACCT-1000.
    • Note: The above Generator provides an easy way to demonstrate this, and you can import the value from a file, database, etc, by using a different Generator.
  • StringRemoveGen - Removes the hyphen from the account number. 



RangeConstantGen

  • startRange - the first number value is '1000' and increases by 1 per record.
  • prefix - each number is preceded by 'ACCT-'.


StringRemoveGen

  • reference  - references the RangeConstantGen (gen1).
  • valueToRemove - hyphen (-)



Example 2 - Remove Dollar Sign from Dollar Amounts

A tester wants to remove the dollar sign ($) from each amount. Examples of the original and modified string values are provided below:  



To do so, they will need to reference the Attribute (or Generator) that is generating the value and configure the following parameters: 

  • reference - references a dollarSign Attribute,  which produces the currency value with a dollar sign
  • valueToRemove - $
  • removalType - removeFirst, remove the first instance in the referenced value