Chapter Contents |
Previous |
Next |
strscan |
Portability: | SAS/C extension |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
CAUTION | |
IMPLEMENTATION | |
EXAMPLE | |
RELATED FUNCTIONS | |
SEE ALSO |
SYNOPSIS |
#include <lcstring.h> char *strscan(const char *str, const char *table);
DESCRIPTION |
strscan
scans a null-terminated string (
str
) using
a translate table (
table
). A translate
table is an array of 256 bytes, one for each EBCDIC character. The
scan terminates at the first character in the string whose table entry is
not 0. The entry for the null character in the table (the first byte) should
be nonzero to avoid scanning past the end of the string.
str
is a pointer
to the string to be scanned, and
table
addresses the first byte (corresponding to the character '\0') of the translate
table. If any character in the string has a nonzero table entry, then the
scan terminates at the first such character, and the address of that character
is returned. If no character in the string before the terminating-null character
has a nonzero table entry, the address of the null character is returned.
RETURN VALUE |
strscan
returns a pointer to the first character in the string whose table entry is
nonzero, or the address of the terminating-null character if there is no such
character and the table entry for '\0' is nonzero.
CAUTION |
If the translate table does not contain
a nonzero entry for the null character or if the
str
argument is not null terminated,
strscan
may search indefinitely for a character with a nonzero table entry.
This may cause an 0C4 or 0C5 ABEND.
IMPLEMENTATION |
strscan
is implemented as a built-in function and uses the TRT instruction to search
for a character with a nonzero entry in the table.
Tables generated by the
strscntb
function always define a nonzero table entry for the null
character.
EXAMPLE |
See the example for
strscntb
.
RELATED FUNCTIONS |
SEE ALSO |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.