mirror of
				https://github.com/tailix/libkernaux.git
				synced 2025-10-30 23:47:50 -04:00 
			
		
		
		
	<ctype.h>: tolower, toupper (#115)
				
					
				
			This commit is contained in:
		
							parent
							
								
									5ea65b6b0c
								
							
						
					
					
						commit
						91bce08aa3
					
				
					 2 changed files with 25 additions and 0 deletions
				
			
		|  | @ -6,7 +6,12 @@ extern "C" { | |||
| #endif | ||||
| 
 | ||||
| int isdigit(int c); | ||||
| int islower(int c); | ||||
| int isspace(int c); | ||||
| int isupper(int c); | ||||
| 
 | ||||
| int tolower(int c); | ||||
| int toupper(int c); | ||||
| 
 | ||||
| #ifdef __cplusplus | ||||
| } | ||||
|  |  | |||
|  | @ -9,7 +9,27 @@ int isdigit(const int c) | |||
|     return (unsigned)c - '0' < 10; | ||||
| } | ||||
| 
 | ||||
| int islower(const int c) | ||||
| { | ||||
|     return (unsigned)c - 'a' < 26; | ||||
| } | ||||
| 
 | ||||
| int isspace(const int c) | ||||
| { | ||||
|     return c == ' ' || (unsigned)c - '\t' < 5; | ||||
| } | ||||
| 
 | ||||
| int isupper(const int c) | ||||
| { | ||||
|     return (unsigned)c - 'A' < 26; | ||||
| } | ||||
| 
 | ||||
| int tolower(const int c) | ||||
| { | ||||
|     return isupper(c) ? (c + ('a' - 'A')) : c; | ||||
| } | ||||
| 
 | ||||
| int toupper(const int c) | ||||
| { | ||||
|     return islower(c) ? (c - ('a' - 'A')) : c; | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Alex Kotov
						Alex Kotov