ReplaceChars

All validation programs

Performs any or all of these and stores the result in a variable:

Format of Parameters

SourceString ResultVar CharsToReplace ReplacementChar

Where:

SourceStr The string to be changed.  This can be a string constant in double quotes, a variable, or a system variable like Current_Element or Current_Date.
ResultVar The variable to contain the result.  This can be the same variable name as specified in SourceString, if desired.
CharsToReplace

A string describing which characters to replace.

See CharstoReplace on page CharstoReplace.

ReplacementChar

A string identifying the character that is to be used to replace all matched characters in CharsToReplace.

This can be:

A single character Replace each matched character with this character.  Examples:  “X“  or “ “
NONE Remove each matched character.

CharstoReplace

This can be one of the following: 

Option

Result

NonX12B

Replace all characters not in the X12 basic character set. This character set includes:

Uppercase letters  A-Z    A-Z

Decimal digits       0-9

Punctuation Characters

        ! " & ' ( ) * + , - . / : ;
        ? = space

NonX12E

Replace all characters not in the X12 extended character set. This character set includes:

Uppercase letters A-Z    A-Z

Lowercase letters a-z    a-z

Decimal digits        0-9

Punctuation Characters    ! " & ' ( ) * + , - . / :
        ;? = % @ [ ] _ { } \ | <
        > ~ # $ space

NonUNOA

Replace all characters not in the EDIFACT UNOA character set. This character set includes:

Uppercase letters A-Z    A-Z

Decimal digits    0-9

Punctuation Characters

    . , - ( ) / = space

NonUNOB

Replace all characters not in the EDIFACT UNOB character set. This character set includes:

Uppercase letters A-Z    A-Z

Lowercase letters a-z    a-z

Decimal digits       0-9

Punctuation Characters    . , - ( ) / = ' + : ?
    ! " % & * space

NonAN

Replace all characters that are not alphanumeric (not an uppercase or lowercase letter or a digit)

LoCC

Replace all control characters that have an ASCII value of 1 through 31

HiCC

Replace all control characters that have an ASCII value of 128 through 255

AllCC

Replace all control characters that have an ASCII value of 1 through 31 or  128 through 255

List’ccc

 

Replace all characters listed in ccc

Example
This removes all colons, commas, and periods:    List’:,.’

To remove a single quote character, use two consecutive single quotes in the ‘ccc’ string. 

Example
This removes all double quote and single quote characters:   List’”’’’

Example 1

This example replaces all lowercase “c” characters with a capital C.

Assume that the current element contains   col. John Crocker

SubmitterVar would then contain  Col. John CroCker.

Example 2

This example replaces any characters that are not in the X12 basic character set with uppercase X so that SpeciesVar contains TXXX XX X XXX .

Example 3

Assume that the current element contains P. O. Box #1234 .

This example removes (not replaces) non-alphanumeric characters so that variable AddressVar contains   P O Box 1234 .

Example 4

Assume that:

NewPatPhoneVar will contain 6144312345 .

Example 5

This causes KAVER Corporation#    to be put into variable CompanyNameVar.