|
1 /** @file ../include/ctype.h |
|
2 @internalComponent |
|
3 */ |
|
4 |
|
5 |
|
6 |
|
7 /** @fn isalnum(int c) |
|
8 @param c |
|
9 @return The isalnum function returns zero if the character is not alphanumeric and |
|
10 returns non-zero if the character tests true. |
|
11 |
|
12 The function isalnum returns non-zero if 'c' is alphanumeric i.e. it belongs to class alnum(see defns for definition). In other words, it returns non-zero if the test for isalpha or isdigit is non-zero, irrespective of the program's current locale. For single character representations, |
|
13 the value of the argument is |
|
14 representable as an unsigned char |
|
15 or the value of EOF. |
|
16 |
|
17 |
|
18 |
|
19 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class alnum, |
|
20 irrespective of the locale they belong to. |
|
21 |
|
22 |
|
23 |
|
24 Examples: |
|
25 @code |
|
26 #include<ctype.h> //isalnum() |
|
27 #include<stdio.h> //printf() |
|
28 void test_isalnum() |
|
29 { |
|
30 int arr[]={'8',0xe1,'5','Z',0xfd}; |
|
31 int i = 0; |
|
32 int size = 5; |
|
33 for( i=0; i<size; i++) |
|
34 { |
|
35 int ret = isalnum(arr[i]); //call to the API with chars in arr[] |
|
36 if( (!ret) != 0 ) |
|
37 { |
|
38 printf(" |
|
39 %c is not alphanumeric", arr[i]); |
|
40 } |
|
41 else |
|
42 { |
|
43 printf(" |
|
44 %c is an alphanumeric ", arr[i]); |
|
45 } |
|
46 } |
|
47 printf(" |
|
48 "); |
|
49 } |
|
50 |
|
51 @endcode |
|
52 Output |
|
53 @code |
|
54 a is an alphanumeric |
|
55 á is an alphanumeric |
|
56 5 is an alphanumeric |
|
57 Z is an alphanumeric |
|
58 ý is an alphanumeric |
|
59 |
|
60 @endcode |
|
61 @see isalpha() |
|
62 @see isdigit() |
|
63 @see iswalnum() |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 @publishedAll |
|
69 @externallyDefinedApi |
|
70 */ |
|
71 |
|
72 /** @fn isalpha(int c) |
|
73 @param c |
|
74 @return The isalpha function returns non-zero if the character is an alphabet and zero otherwise. |
|
75 |
|
76 The isalpha function returns non-zero if 'c' is an alphabet i.e. it belongs to class alpha (see defns for definition). In other words, it returns non-zero if the test for isupper or islower is non-zero,irrespective of the program's current locale. The function will return non-zero for also those characters that are alphabets and cannot be categorised as upper or lower case. |
|
77 For single character representations, |
|
78 the value of the argument is |
|
79 representable as an unsigned char |
|
80 or the value of EOF. |
|
81 |
|
82 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class alpha, irrespective of the locale they belong to. |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 Examples: |
|
89 @code |
|
90 #include<ctype.h> //isalpha() |
|
91 #include<stdio.h> //printf() |
|
92 void test_isalpha() |
|
93 { |
|
94 int arr[]={'a',0xe1,'5','Z',0xfd}; |
|
95 int i = 0; |
|
96 int size = 5; |
|
97 for( i=0; i<size; i++) |
|
98 { |
|
99 int ret = isalpha(arr[i]); //call to the API with chars in arr[] |
|
100 if( (!ret) != 0 ) |
|
101 { |
|
102 printf(" |
|
103 %c is not an alphabet", arr[i]); |
|
104 } |
|
105 else |
|
106 { |
|
107 printf(" |
|
108 %c is an alphabet", arr[i]); |
|
109 } |
|
110 } |
|
111 printf(" |
|
112 "); |
|
113 } |
|
114 |
|
115 @endcode |
|
116 Output |
|
117 @code |
|
118 a is an alphabet |
|
119 á is an alphabet |
|
120 5 is not an alphabet |
|
121 Z is an alphabet |
|
122 ý is an alphabet |
|
123 |
|
124 |
|
125 @endcode |
|
126 @see islower() |
|
127 @see isupper() |
|
128 @see iswalpha() |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 @publishedAll |
|
134 @externallyDefinedApi |
|
135 */ |
|
136 |
|
137 /** @fn iscntrl(int c) |
|
138 @param c |
|
139 @return The iscntrl function returns non-zero if 'c' is control character and zero otherwise. |
|
140 |
|
141 The iscntrl function tests if 'c' is a control character i.e. it belongs to class cntrl(see defns for definition). |
|
142 For single character representations, |
|
143 the value of the argument is |
|
144 representable as an unsigned char |
|
145 or the value of EOF. |
|
146 |
|
147 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class cntrl, irrespective of the locale they belong to. |
|
148 |
|
149 Examples: |
|
150 @code |
|
151 #include<ctype.h> //iscntrl() |
|
152 #include<stdio.h> //printf() |
|
153 int test_iscntrl() |
|
154 { |
|
155 int arr[]={0x7F,’9’,’A’,’$’,’\a’ }; |
|
156 int i = 0; |
|
157 int size = 5; |
|
158 for( i=0; i<size; i++) |
|
159 { |
|
160 int ret = iscntrl(arr[i]); //call to the API with chars in arr[] |
|
161 if( (!ret) != 0 ) |
|
162 { |
|
163 printf(" |
|
164 %c is not cntrl char ", arr[i]); |
|
165 } |
|
166 else |
|
167 { |
|
168 printf(" |
|
169 %c is cntrl char", arr[i]); |
|
170 } |
|
171 } |
|
172 printf(" |
|
173 "); |
|
174 } |
|
175 |
|
176 @endcode |
|
177 Output |
|
178 @code |
|
179 is cntrl char |
|
180 9 is not cntrl char |
|
181 A is not cntrl char |
|
182 $ is not cntrl char |
|
183 is cntrl char |
|
184 |
|
185 @endcode |
|
186 @see iswcntrl() |
|
187 |
|
188 |
|
189 |
|
190 |
|
191 @publishedAll |
|
192 @externallyDefinedApi |
|
193 */ |
|
194 |
|
195 |
|
196 /** @fn isdigit(int c) |
|
197 @param c |
|
198 @return The isdigit function returns non-zero if the character is a digit and zero otherwise. |
|
199 |
|
200 The isdigit function tests if ’c’ is a decimal digit character. Regardless of locale, this includes the following characters only: |
|
201 |
|
202 @code |
|
203 ‘‘0’’ ‘‘1’’ ‘‘2’’ ‘‘3’’ ‘‘4’’ |
|
204 ‘‘5’’ ‘‘6’’ ‘‘7’’ ‘‘8’’ ‘‘9’’ |
|
205 @endcode |
|
206 |
|
207 Examples: |
|
208 @code |
|
209 #include<ctype.h> //isdigit() |
|
210 #include<stdio.h> //printf() |
|
211 void test_isdigit() |
|
212 { |
|
213 int arr[]={'8',0xe1,'5','Z',0xfd}; |
|
214 int i = 0; |
|
215 int size = 5; |
|
216 for( i=0; i<size; i++) |
|
217 { |
|
218 int ret = isdigit(arr[i]); //call to the API with chars in arr[] |
|
219 if( (!ret) != 0 ) |
|
220 { |
|
221 printf(" |
|
222 %c is not a digit", arr[i]); |
|
223 } |
|
224 else |
|
225 { |
|
226 printf(" |
|
227 %c is a digit", arr[i]); |
|
228 } |
|
229 } |
|
230 printf(" |
|
231 "); |
|
232 } |
|
233 |
|
234 @endcode |
|
235 Output |
|
236 @code |
|
237 8 is a digit |
|
238 á is not a digit |
|
239 5 is a digit |
|
240 Z is not a digit |
|
241 ý is not a digit |
|
242 |
|
243 |
|
244 @endcode |
|
245 @see iswdigit() |
|
246 @see defns() |
|
247 |
|
248 |
|
249 |
|
250 |
|
251 @publishedAll |
|
252 @externallyDefinedApi |
|
253 */ |
|
254 |
|
255 /** @fn isgraph(int c) |
|
256 @param c |
|
257 @return The isgraph function returns non-zero if 'c' has a visible representation and zero otherwise. |
|
258 |
|
259 The isgraph function returns non-zero if 'c' has visible representation i.e. it belongs to class graph(see defns for definition). It does not consider characters classified under class space |
|
260 and class cntrl (see defns for definition). |
|
261 For single character representations, |
|
262 the value of the argument is |
|
263 representable as an unsigned char |
|
264 or the value of EOF. |
|
265 |
|
266 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class graph, irrespective of the locale they belong to. |
|
267 |
|
268 Examples: |
|
269 @code |
|
270 #include<ctype.h> //isgraph() |
|
271 #include<stdio.h> //printf() |
|
272 int test_isgraph() |
|
273 { |
|
274 int arr[]={’n’,’\f’, ’6’, ’ ’}; |
|
275 int i = 0; |
|
276 int size = 4; |
|
277 for( i=0; i<size; i++) |
|
278 { |
|
279 int ret = isgraph(arr[i]); //call to API with chars in arr[] |
|
280 if( (!ret) != 0 ) |
|
281 { |
|
282 printf(" |
|
283 %c is not visible char ", arr[i]); |
|
284 } |
|
285 else |
|
286 { |
|
287 printf(" |
|
288 %c is visible char", arr[i]); |
|
289 } |
|
290 } |
|
291 printf(" |
|
292 "); |
|
293 } |
|
294 |
|
295 @endcode |
|
296 Output |
|
297 @code |
|
298 n is visible char |
|
299 is not visible char |
|
300 6 is visible char |
|
301 is not visible char |
|
302 |
|
303 @endcode |
|
304 @see iswgraph() |
|
305 |
|
306 |
|
307 |
|
308 |
|
309 @publishedAll |
|
310 @externallyDefinedApi |
|
311 */ |
|
312 |
|
313 /** @fn islower(int c) |
|
314 @param c |
|
315 @return The islower function returns non-zero is 'c' is a lower-case alphabet and zero otherwise. |
|
316 |
|
317 The islower function tests if 'c' belongs to the set of lower-case letters i.e. it belongs to class lower(see defns for definition). |
|
318 For single character representations, |
|
319 the value of the argument is |
|
320 representable as an unsigned char |
|
321 or the value of EOF. |
|
322 |
|
323 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class lower, irrespective of the locale they belong to. |
|
324 |
|
325 |
|
326 |
|
327 Examples: |
|
328 @code |
|
329 #include<ctype.h> //islower() |
|
330 #include<stdio.h> //printf() |
|
331 int test_islower() |
|
332 { |
|
333 int arr[]={0x0126,0xee,'r','9','g'}; |
|
334 int i = 0; |
|
335 int size = 5; |
|
336 for( i=0; i<size; i++) |
|
337 { |
|
338 int ret = islower(arr[i]); //call to the API with chars in the arr[] |
|
339 if( (!ret) != 0 ) |
|
340 { |
|
341 printf(" |
|
342 %c is not in lower-case ", arr[i]); |
|
343 } |
|
344 else |
|
345 { |
|
346 printf(" |
|
347 %c is in lower-case", arr[i]); |
|
348 } |
|
349 } |
|
350 printf(" |
|
351 "); |
|
352 } |
|
353 |
|
354 @endcode |
|
355 Output |
|
356 @code |
|
357 & is not in lower-case |
|
358 î is in lower-case |
|
359 r is in lower-case |
|
360 9 is not in lower-case |
|
361 g is in lower-case |
|
362 |
|
363 |
|
364 @endcode |
|
365 @see iswlower() |
|
366 @see tolower() |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 @publishedAll |
|
372 @externallyDefinedApi |
|
373 */ |
|
374 |
|
375 /** @fn isprint(int c) |
|
376 @param c |
|
377 @return The isprint function returns non-zero if 'c' is printable and zero otherwise. |
|
378 |
|
379 The isprint function returns true if 'c' is a printable character. It considers characters under class space, but characters falling under class cntrl will not be considered(see defns for definition of these classes). |
|
380 |
|
381 For single character representations, |
|
382 the value of the argument is |
|
383 representable as an unsigned char |
|
384 or the value of EOF. |
|
385 |
|
386 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class print(see defns for definition), irrespective of the locale they belong to. |
|
387 |
|
388 |
|
389 |
|
390 Examples: |
|
391 @code |
|
392 #include<ctype.h> //isprint() |
|
393 #include<stdio.h> //printf() |
|
394 int test_isprint() |
|
395 { |
|
396 int arr[]={’n’,’\f’, 0xe1, ’6’, ’ ’}; |
|
397 int i = 0; |
|
398 int size = 5; |
|
399 for( i=0; i<size; i++) |
|
400 { |
|
401 int ret = isprint(arr[i]); //call to the API with the chars in arr[] |
|
402 if( (!ret) != 0 ) |
|
403 { |
|
404 printf(" |
|
405 %c is not printable char ", arr[i]); |
|
406 } |
|
407 else |
|
408 { |
|
409 printf(" |
|
410 %c is printable char", arr[i]); |
|
411 } |
|
412 } |
|
413 printf(" |
|
414 "); |
|
415 } |
|
416 |
|
417 @endcode |
|
418 Output |
|
419 @code |
|
420 n is printable char |
|
421 is not printable char |
|
422 á is not printable char |
|
423 6 is printable char |
|
424 is printable char |
|
425 |
|
426 |
|
427 @endcode |
|
428 @see iswprint() |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 @publishedAll |
|
434 @externallyDefinedApi |
|
435 */ |
|
436 |
|
437 /** @fn ispunct(int c) |
|
438 @param c |
|
439 @return The ispunct function returns non-zero if 'c' is a punctuation character and zero otherwise. |
|
440 |
|
441 The ispunct function tests if 'c' is a punctuation character i.e. it belongs to class punct(see defns for definition). Characters under class space |
|
442 or a |
|
443 character for which isalnum is true(non-zero) are excluded. In other words, it tests for punctuation characters. |
|
444 For single character representations, |
|
445 the value of the argument is |
|
446 representable as an unsigned char |
|
447 or the value of EOF. |
|
448 |
|
449 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class punct, irrespective of the locale they belong to. |
|
450 |
|
451 |
|
452 |
|
453 Examples: |
|
454 @code |
|
455 #include<ctype.h> //ispunct() |
|
456 #include<stdio.h> //printf() |
|
457 int test_ispunct() |
|
458 { |
|
459 int arr[]={0x3003,'3',0x301C,'*', '+'}; |
|
460 int i = 0; |
|
461 int size = 5; |
|
462 for( i=0; i<size; i++) |
|
463 { |
|
464 int ret = ispunct(arr[i]); //call to the API with chars in arr[] |
|
465 if( (!ret) != 0 ) |
|
466 { |
|
467 printf(" |
|
468 0x%x is not a punc char ", arr[i]); |
|
469 } |
|
470 else |
|
471 { |
|
472 printf(" |
|
473 0x%x is a punc char", arr[i]); |
|
474 } |
|
475 } |
|
476 printf(" |
|
477 "); |
|
478 return 0; |
|
479 } |
|
480 |
|
481 @endcode |
|
482 Output |
|
483 @code |
|
484 0x3003 is a punc char |
|
485 0x33 is not a punc char |
|
486 0x301c is a punc char |
|
487 0x2a is a punc char |
|
488 0x2b is a punc char |
|
489 |
|
490 @endcode |
|
491 @see iswpunct() |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 @publishedAll |
|
497 @externallyDefinedApi |
|
498 */ |
|
499 |
|
500 /** @fn isspace(int c) |
|
501 @param c |
|
502 @return The isspace function returns non-zero if 'c' is space character and zero otherwise. |
|
503 |
|
504 The isspace function tests if 'c' is from among white-space characters i.e. it belongs to class space(see defns for definition). |
|
505 This includes the following standard characters: |
|
506 |
|
507 SPACE |
|
508 |
|
509 FORM-FEED |
|
510 |
|
511 NEWLINE |
|
512 |
|
513 CARRIAGE-RETURN |
|
514 |
|
515 TAB |
|
516 |
|
517 VERTICAL-TAB |
|
518 |
|
519 For single character representations, |
|
520 the value of the argument is |
|
521 representable as an unsigned char |
|
522 or the value of EOF. |
|
523 |
|
524 |
|
525 |
|
526 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class space, irrespective of the locale they belong to. |
|
527 |
|
528 |
|
529 |
|
530 Examples: |
|
531 @code |
|
532 #include<ctype.h> //isspace() |
|
533 #include<stdio.h> //printf() |
|
534 int test_isspace() |
|
535 { |
|
536 int arr[]={' |
|
537 ','0','w','R',0x3000,' '}; |
|
538 int i = 0; |
|
539 int size = 5; |
|
540 for( i=0; i<size; i++) |
|
541 { |
|
542 int ret = isspace(arr[i]); //call to the API with chars in arr[] |
|
543 if( (!ret) != 0 ) |
|
544 { |
|
545 printf(" |
|
546 %c is not space char ", arr[i]); |
|
547 } |
|
548 else |
|
549 { |
|
550 printf(" |
|
551 %c is space char", arr[i]); |
|
552 } |
|
553 } |
|
554 printf(" |
|
555 "); |
|
556 } |
|
557 |
|
558 @endcode |
|
559 Output |
|
560 @code |
|
561 is space char |
|
562 0 is not space char |
|
563 w is not space char |
|
564 R is not space char |
|
565 is space char |
|
566 |
|
567 @endcode |
|
568 @see iswspace() |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 @publishedAll |
|
574 @externallyDefinedApi |
|
575 */ |
|
576 |
|
577 /** @fn isupper(int c) |
|
578 @param c |
|
579 @return The isupper function returns non-zero if 'c' is in upper case and zero otherwise. |
|
580 |
|
581 The isupper function tests if 'c' is an upper-case alphabet i.e. it belongs to class upper(see defns for definition). |
|
582 For single character representations, |
|
583 the value of the argument is |
|
584 representable as an unsigned char |
|
585 or the value of EOF. |
|
586 |
|
587 The functionality of this API is independent of the program's current locale and so it returns non-zero for all the characters (of various locales supported) that belong to the class upper, irrespective of the locale they belong to. |
|
588 |
|
589 |
|
590 |
|
591 Examples: |
|
592 @code |
|
593 #include<ctype.h> //isupper() |
|
594 #include<stdio.h> //printf() |
|
595 int test_isupper() |
|
596 { |
|
597 int arr[]={0x0126,'G','7','B',0x3041}; |
|
598 int i = 0; |
|
599 int size = 5; |
|
600 for( i=0; i<size; i++) |
|
601 { |
|
602 int ret = isupper(arr[i]); //call to the API with chars in arr[] |
|
603 if( (!ret) != 0 ) |
|
604 { |
|
605 printf(" |
|
606 %c is not in upper-case ", arr[i]); |
|
607 } |
|
608 else |
|
609 { |
|
610 printf(" |
|
611 %c is in upper-case", arr[i]); |
|
612 } |
|
613 } |
|
614 printf(" |
|
615 "); |
|
616 } |
|
617 |
|
618 @endcode |
|
619 Output |
|
620 @code |
|
621 & is in upper-case |
|
622 G is in upper-case |
|
623 7 is not in upper-case |
|
624 B is in upper-case |
|
625 A is in upper-case |
|
626 |
|
627 @endcode |
|
628 @see iswupper() |
|
629 @see toupper() |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 @publishedAll |
|
635 @externallyDefinedApi |
|
636 */ |
|
637 |
|
638 /** @fn isxdigit(int c) |
|
639 @param c |
|
640 @return The isxdigit function returns non-zero if 'c' is a character used for hex-representation and zero otherwise. The iswxdigit function should be used instead. |
|
641 |
|
642 The isxdigit function tests if ’c’ is a hexadecimal-digit character. Regardless of locale, this includes the following characters only: |
|
643 @code |
|
644 ‘‘0’’ ‘‘1’’ ‘‘2’’ ‘‘3’’ ‘‘4’’ |
|
645 ‘‘5’’ ‘‘6’’ ‘‘7’’ ‘‘8’’ ‘‘9’’ |
|
646 ‘‘A’’ ‘‘B’’ ‘‘C’’ ‘‘D’’ ‘‘E’’ |
|
647 ‘‘F’’ ‘‘a’’ ‘‘b’’ ‘‘c’’ ‘‘d’’ |
|
648 ‘‘e’’ ‘‘f’’ |
|
649 |
|
650 @endcode |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 Examples: |
|
656 @code |
|
657 #include<ctype.h> //isxdigit() |
|
658 #include<stdio.h> //printf() |
|
659 int test_isxdigit() |
|
660 { |
|
661 int arr[]={'F','a','M','9','2'}; |
|
662 int i = 0; |
|
663 int size = 5; |
|
664 for( i=0; i<size; i++) |
|
665 { |
|
666 int ret = isxdigit(arr[i]); //call to the API with chars in arr[] |
|
667 if( (!ret) != 0 ) |
|
668 { |
|
669 printf(" |
|
670 %c is not hex-digit ", arr[i]); |
|
671 } |
|
672 else |
|
673 { |
|
674 printf(" |
|
675 %c is hex-digit", arr[i]); |
|
676 } |
|
677 } |
|
678 printf(" |
|
679 "); |
|
680 } |
|
681 |
|
682 @endcode |
|
683 Output |
|
684 @code |
|
685 F is hex-digit |
|
686 a is hex-digit |
|
687 M is not hex-digit |
|
688 9 is hex-digit |
|
689 2 is hex-digit |
|
690 |
|
691 @endcode |
|
692 @see iswxdigit() |
|
693 @see defns() |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 @publishedAll |
|
699 @externallyDefinedApi |
|
700 */ |
|
701 |
|
702 /** @fn tolower(int c) |
|
703 @param c |
|
704 @return If the argument is an upper-case letter, the tolower function returns the corresponding lower-case letter if there |
|
705 is one; otherwise the argument is returned unchanged. The wide version, towlower , should normally be used instead. |
|
706 |
|
707 The tolower function converts an upper-case letter to the corresponding lower-case |
|
708 letter. |
|
709 For single character representations, |
|
710 the value of the argument is |
|
711 representable as an unsigned char |
|
712 or the value of EOF . |
|
713 |
|
714 The functionality of this API is independent of the program's current locale. |
|
715 |
|
716 |
|
717 |
|
718 Examples: |
|
719 @code |
|
720 #include<ctype.h> //tolower() |
|
721 #include<stdio.h> //printf() |
|
722 int test_tolower () |
|
723 { |
|
724 struct st |
|
725 { |
|
726 int input; |
|
727 int output; |
|
728 }; |
|
729 struct st arr[]= |
|
730 { |
|
731 { 'Q', 'q' }, |
|
732 { 'g' , 'g' }, |
|
733 { '9' , '9' }, |
|
734 { '%' , '%' }, |
|
735 { ' ' , ' ' }, |
|
736 }; |
|
737 int i = 0; |
|
738 int size = 5; |
|
739 for( i=0; i<size; i++) |
|
740 { |
|
741 int ret = tolower(arr[i].input);//call to the API with the chars in the arr[] |
|
742 if( ret != arr[i].output ) |
|
743 { |
|
744 printf(" |
|
745 %c cannot convert ", arr[i].input); |
|
746 } |
|
747 else |
|
748 { |
|
749 printf(" |
|
750 %c ", arr[i].output); |
|
751 } |
|
752 } |
|
753 printf(" |
|
754 "); |
|
755 } |
|
756 |
|
757 @endcode |
|
758 Output |
|
759 @code |
|
760 q |
|
761 g |
|
762 9 |
|
763 % |
|
764 |
|
765 |
|
766 @endcode |
|
767 @see islower() |
|
768 @see towlower() |
|
769 @see defns() |
|
770 |
|
771 |
|
772 |
|
773 |
|
774 @publishedAll |
|
775 @externallyDefinedApi |
|
776 */ |
|
777 |
|
778 /** @fn toupper(int c) |
|
779 @param c |
|
780 @return If the argument is a lower-case letter, the toupper function returns the corresponding upper-case letter if there |
|
781 is one; otherwise the argument is returned unchanged. The wide version, towupper , should normally be used instead. |
|
782 |
|
783 The toupper function converts a lower-case letter to the corresponding |
|
784 upper-case letter. |
|
785 For single character representations, |
|
786 the value of the argument is |
|
787 representable as an unsigned char |
|
788 or the value of EOF . |
|
789 The functionality of this API is independent of the program's current locale. |
|
790 |
|
791 Examples: |
|
792 @code |
|
793 #include<ctype.h> //toupper() |
|
794 #include<stdio.h> //printf() |
|
795 int test_toupper() |
|
796 { |
|
797 struct st |
|
798 { |
|
799 int input; |
|
800 int output; |
|
801 }; |
|
802 struct st arr[]= |
|
803 { |
|
804 { 'q', 'Q' }, |
|
805 { 'G' , 'G' }, |
|
806 { '9' , '9' }, |
|
807 { '%' , '%' }, |
|
808 { ' ' , ' ' }, |
|
809 }; |
|
810 int i = 0; |
|
811 int size = 5; |
|
812 for( i=0; i<size; i++) |
|
813 { |
|
814 int ret = toupper(arr[i].input);//call to the API with the chars in arr[] |
|
815 if( ret != arr[i].output ) |
|
816 { |
|
817 printf(" |
|
818 %c cannot convert ", arr[i].input); |
|
819 } |
|
820 else |
|
821 { |
|
822 printf(" |
|
823 %c ", arr[i].output); |
|
824 } |
|
825 } |
|
826 printf(" |
|
827 "); |
|
828 } |
|
829 |
|
830 @endcode |
|
831 Output |
|
832 @code |
|
833 q |
|
834 G |
|
835 9 |
|
836 % |
|
837 |
|
838 @endcode |
|
839 @see isupper() |
|
840 @see towupper() |
|
841 @see defns() |
|
842 |
|
843 |
|
844 |
|
845 |
|
846 @publishedAll |
|
847 @externallyDefinedApi |
|
848 */ |
|
849 |
|
850 /** @def _tolower(c) |
|
851 |
|
852 This macro always expect that the argument sent is always in uppercase and works only with c locale. |
|
853 else the behavior is undefined |
|
854 |
|
855 @publishedAll |
|
856 @released |
|
857 */ |
|
858 |
|
859 /** @def _toupper(c) |
|
860 |
|
861 This macro always expect that the argument sent is always in lowercase and works only with c locale. |
|
862 else the behavior is undefined |
|
863 |
|
864 @publishedAll |
|
865 @released |
|
866 */ |
|
867 |
|
868 /** @def isascii(c) |
|
869 |
|
870 Checks if ascii. |
|
871 |
|
872 @publishedAll |
|
873 @released |
|
874 */ |
|
875 |
|
876 /** @def toascii(c) |
|
877 |
|
878 Converts to ascii. |
|
879 |
|
880 @publishedAll |
|
881 @released |
|
882 */ |
|
883 |
|
884 |
|
885 |
|
886 |