1 #pragma comment (compiler)
2 //#pragma comment (date)
3 //#pragma comment (timestamp)
6 #include "Local.h" /* standard header file */
10 #pragma subtitle("stspack3 - Local string test functions ")
11 /********************************************************************/
14 /* Organization: W/OSO242 - GRAPHICS AND DISPLAY SECTION */
15 /* Date: 05 Oct 1992 */
16 /* Programmer: ALLAN DARLING */
19 /* Abstract: The stspack3 package contains functions to */
20 /* perform the isalnum through isxdigit functions */
21 /* on strings. The functions come in four forms: */
22 /* those that test NULL delimited strings and are */
23 /* named in the form sxxxxxxx, those that test at */
24 /* most n characters and are named in the form */
25 /* nxxxxxxx, those that search forward in a string */
26 /* and are named in the form nxtyyyyy, and those */
27 /* that search backward in a string and are named */
28 /* in the form lstyyyyy. */
30 /* The xxxxxxx is the name of the test applied to */
31 /* each character in the string, such as isalpha, */
32 /* thus a function to test a NULL delimited string */
33 /* an return a nonzero value if all characters in */
34 /* the string are digits is named sisdigit. */
36 /* The yyyyy is the name of the test applied to */
37 /* characters in a string, minus the 'is' prefix. */
38 /* Thus a function to find the next digit in a NULL */
39 /* delimited string and return a pointer to it is */
42 /* The only exception to the naming rule is for the */
43 /* functions that test for hexadecimal digits. */
44 /* These are named sisxdigi, nisxdigi, nxtxdigi, */
45 /* and lstxdigi because of the eight character */
46 /* function name limitation. */
48 /* The nxxxxxxx class of functions will test up to */
49 /* n characters or the first NULL character */
50 /* encountered, whichever comes first. For all */
51 /* classes of functions, the string sentinal is */
52 /* not included in the test. */
54 /* External Functions Called: */
55 /* isalnum, isalpha, iscntrl, isdigit, isgraph, */
56 /* islower, isprint, ispunct, isspace, isupper, */
59 /* Input: For sxxxxxxx class functions, a pointer to a */
60 /* NULL delimited character string. */
62 /* For nxtyyyyy class functions, a pointer to a */
63 /* NULL delimited character string. */
65 /* for nxxxxxxx class functions, a pointer to a */
66 /* character array, and a positive, nonzero integer.*/
68 /* for lstyyyyy class functions, a pointer to a */
69 /* character array, and a positive, nonzero integer.*/
71 /* Output: A nonzero value if the test is true for all */
72 /* characters in the string, a zero value otherwise.*/
74 /* Modification History: */
77 /********************************************************************/
79 char *nxtalnum(char *s) {
81 for (; !isalnum(*s) && *s; s++) ;
91 char *nxtalpha(char *s) {
93 for (; !isalpha(*s) && *s; s++) ;
103 char *nxtcntrl(char *s) {
105 for (; !iscntrl(*s) && *s; s++) ;
115 char *nxtdigit(char *s) {
117 for (; !isdigit(*s) && *s; s++) ;
127 char *nxtgraph(char *s) {
129 for (; !isgraph(*s) && *s; s++) ;
139 char *nxtlower(char *s) {
141 for (; !islower(*s) && *s; s++) ;
151 char *nxtprint(char *s) {
153 for (; !isprint(*s) && *s; s++) ;
163 char *nxtpunct(char *s) {
165 for (; !ispunct(*s) && *s; s++) ;
175 char *nxtspace(char *s) {
177 for (; !isspace(*s) && *s; s++) ;
187 char *nxtupper(char *s) {
189 for (; !isupper(*s) && *s; s++) ;
199 char *nxtxdigi(char *s) {
201 for (; !isxdigit(*s) && *s; s++) ;