HEAD Function

── HEAD ── ( ──<string expression>── , ──<string character set>── ) ───┤

<string character set>

──┬───────┬─┬─<string constant>─┬──────────────────────────────────────┤
  └─ NOT ─┘ └─<truth set table>─┘

The HEAD function returns a string whose value consists of the leftmost characters of the string expression up to, but not including, the first character that is not a member of the string character set. If the first character of the string expression is not a member of the string character set, the null string is returned. If all characters of the string expression are members of the string character set, the entire string expression is returned.

The string character set must be of the same character type as the string expression. If a truth set table is used, it must not be composed of characters of different character types. The option NOT indicates a string character set made up of all characters that are not specified in the string constant or truth set table, but that are of the same character type as the string expression.

The HEAD function and the TAIL function are complementary functions. This means that for any string expression S and any string character set C, the following relation is always TRUE:

S = HEAD(SC) CAT TAIL(SC)

For more information, see TAIL Function.

Examples of the HEAD Function

In the following examples, S is a string of length 9 that contains 8"ABC/1-2+3".

HEAD(S,NOT "/") = 8"ABC"

HEAD(S,ALPHA) = 8"ABC"

HEAD(S,"123") = the null string