Formatting filter functions  Text manipulation functions

Chapter 3: Building Production Objects

Editing functions

Editing filter functions edit the data in the current blob area; for example, adding data or eliminating data or extra spaces. With some of the filter functions in this category, you can use octal escape sequences or ASCII characters. When using octal escape sequences in a filter’s arguments, use “\NUL” instead of “\000” to indicate a null value.


append()

Description

Adds the data in the argument string (for example, add literals, or punctuation values to an existing field or component) to the end of the current blob area.

Arguments

The text you want to add to the blob area; for example, “M.D.”.


delimit()

Description

Removes all data from the current blob area that follows a specific character as identified by the value in the argument, and also removes the specified character. Adjusts its internal information to the new shorter length value. This function works from left to right in the blob area and stops when it reaches the first occurrence of the specified character.

Arguments

The character that delimits the field; for example, (quote) or \ (backslash) or , (comma).


insert()

Description

Inserts a character into an output blob area at the specified location and for the length given.

Arguments

OOO,LLL,X

where “OOO” is offset in current blob area; “LLL” is the length of the data to insert; and “X” is character to insert (optional); for example, “20,10,q”.

The default is null (binary zero).


modChar()

Description

Replaces all characters in the current blob area that match the first character in the arguments field with the second character in the arguments field. You can also use octal escape sequences to specify a value.

Arguments

The character you want replaced and its replacement.

Examples


modFirstChar()

Description

Replaces the first occurrence of a character in the blob area that matches the first character in the arguments field with the second character in the arguments field. You can also use octal escape sequences to specify a value.

Arguments

The character you want the first occurrence of replaced, and its replacement.

Examples

An argument of “@*” causes replacement of the first occurrence of “@” with “*”.


modLastChar()

Description

Replaces the last occurrence of a character in the blob area that matches the first character in the arguments field with the second character in the arguments field. You can also use octal escape sequences to specify a value.

Arguments

The character you want the last occurrence of replaced, and its replacement.

Examples

An argument of “^|” causes replacement of the last occurrence of “^” with“|”.


modLeadChar()

Description

Replaces all leading characters in the current blob area that match the first character in the arguments field with the second character in the arguments field. You can also use octal escape sequences to specify a value.

Arguments

The character you want replaced, and its replacement.

Examples

An argument of “#$” causes replacement of leading “#” with “$”.


modTrailChar()

Description

Replaces all trailing characters specified in the arguments from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

The character you want replaced, and its replacement.

Examples


modPattern()

Description

Replaces the characters specified in the arguments from the current blob area. You can use octal escape sequences to specify a value.

Arguments

Search pattern | replacement pattern.

Examples

An argument of “\012123|A\010BC” causes replacement of all “<FORM FEED>123” with “A<LINE FEED>BC”.


snip()

Description

Removes part of the current output blob area at the specified location (offset) and for the given length.

Arguments

OOO,LLL

where “OOO” is the offset in current blob area; “LLL” is the length to cut with a maximum of 32767. To cut to end of blob, use the maximum value.

Examples

012,003 specifies that at offset position 12, remove 3 characters.


strInsChar()

Description

Inserts a string into the current blob area following the first occurrence of the specified character. You can also use octal escape sequences for the specified character. Use a comma or a pipe to separate the arguments.

Arguments

character, string

where “character” is the character after which to insert the string, and “string” is the data to insert.

Examples

$,new data specifies that after the first $, insert “new data”.


strInsert()

Description

Inserts a string into the current blob area at the specified offset location (optional). If you do not specify an offset, the filter inserts the string at the beginning of the blob area. When not using an offset, the string must start with an alphabetic character. Use a comma to separate the arguments.

Arguments

offset,string

where “offset” is the location to insert the string, starting from zero (0), and

string” is the data to insert.

Examples


strInsPattern()

Description

Inserts a string into the current blob area following the first occurrence of the specified pattern. Use a comma or a pipe to separate the arguments. The pattern cannot contain a comma or a pipe; the filter treats it as the argument “separator.”

Arguments

pattern,string

where “pattern” is the pattern after which to insert the string, and “string” is the data to insert.

Examples


zap()

Description

Removes the characters listed in the arguments from the current blob area. You cannot use octal escape sequences to specify a value.

Arguments

The characters you want removed.

Examples


zapChar()

Description

Removes the character specified in the arguments from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

The character you want removed.

Examples


zapFirstChar()

Description

Removes the first occurrence of the character specified in the arguments from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

The character that you want the first occurrence of removed.

Examples

An argument of “@” causes removal of the first occurrence of “@” from the blob area.


zapLastChar()

Description

Removes the last occurrence of the character specified in the arguments from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

The character that you want the last occurrence of removed.

Examples

An argument of “&” causes removal of the first occurrence of “&” from the blob area.


zapLeadChar()

Description

Removes all leading characters specified in args from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

None.

Examples

An argument of “#” causes removal of leading “#” from the blob area.


zapLeadSpaces()

Description

Removes all leading spaces from the current blob area.

Arguments

None.


zapPattern()

Description

Removes the sequence of characters specified in the arguments from the current blob area. You cannot use octal escape sequences to specify a value.

Arguments

The pattern of characters you want removed.

Examples

An argument of “123ABC” causes removal of all “123ABC” from the blob area.


zapRange()

Description

Removes the range of characters specified in the arguments from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

The beginning and end of the range of characters that you want removed.

Examples


zapSpaces()

Description

Removes all spaces from the current blob area.

Arguments

None.


zapTrailChar()

Description

Removes all trailing characters specified in the arguments field from the current blob area. You can also use octal escape sequences to specify a value.

Arguments

The character you want removed.

Examples


zapTrailSpaces()

Description

Removes all trailing spaces from the current blob area.

Arguments

None.





Copyright © 2005. Sybase Inc. All rights reserved. Text manipulation functions

View this book as PDF