990
Appendix A: System Routines — Strings
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
strchr
Declaration:
char *
strchr
(const char *
str
, int
c
)
Category(ies):
Strings
Description:
Locates the first occurrence of the character
c
in the string pointed to by
str
. The character
c
may be any character including the null character (\0).
Inputs:
str
— Character string to search.
c
— Character to locate.
Outputs:
Returns a pointer to the first occurrence of
c
in
str
. If
c
is not in
str
,
strchr
returns a null pointer.
Assumptions:
None
Side Effects:
None
Availability:
All versions of the TI
-
89 / TI
-
92 Plus.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: strrchr, memchr, strspn, strcspn, strpbrk, strstr
Example:
short KeyYesOrNo( WORD Key )
/* If Key is ENTER or is an alpha and in XR_YesStr return TRUE,
if it is ESC or is an alpha and in XR_NoStr return FALSE,
otherwise return -1.
*/
{
if (Key == KB_ENTER)
return TRUE;
if (Key == KB_ESC)
return FALSE;
if (Key <= 0xFF) {
if (strchr(XR_stringPtr(XR_YesStr), (BYTE) Key ))
return TRUE;
if (strchr(XR_stringPtr(XR_NoStr), (BYTE) Key ))
return FALSE;
}
return -1;
}