Chameleon provides built-in Python functions that strip unwanted characters from
segment, table or message data.
Function
Effect
Example
strip_chars
Strips the specified character from the field. This is useful for stripping unwanted separator characters from fields like SSN numbers.
value = strip_chars('_', value)
value = strip_chars('/', value)
strip_leading_chars
Strips leading characters of the specified type from the start of the field. This is useful for stripping leading zeros from Patient ID fields.
value = strip_leading_chars('0', value)
strip_trailing_chars
Strips trailing characters of the specified type from the end of the field.
value = strip_trailing_chars('0', value)
strip_non_numeric_chars
Strips non-numeric characters.
value = strip_non_numeric_chars(value)
Python also provides built-in functions that strip characters:
The re.sub function can strip a specified character or all non-numeric characters from a field.
For more information on re.sub, see Substitution
Using Pattern Matching.
The lstrip and rstrip functions can strip unwanted leading and trailing characters from
a field. For details, see
Editing a String.