1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-12-26 11:30:03 +05:30
gists/c-programming/strings/string_case.c

39 lines
1.1 KiB
C

/*
* string_case.c
*
* Author: Intel A80486DX2-66
* License: Unlicense
*/
#include "string_case.h"
char* ascii_lowercase_str(const char* s) { ASCII_LOWERCASE_STR_T(s); }
char* ascii_lowercase_strm(char* s) { ASCII_LOWERCASE_STRM_T(s); }
char* ascii_uppercase_str(const char* s) { ASCII_UPPERCASE_STR_T(s); }
char* ascii_uppercase_strm(char* s) { ASCII_UPPERCASE_STRM_T(s); }
#ifdef TEST
# include <stdio.h>
# include <stdlib.h>
int main(void) {
printf("Constant string:\n");
const char* const_str = "Hello, World!";
char* str1 = ascii_lowercase_str(const_str),
* str2 = ascii_uppercase_str(const_str);
printf("original string: %s\n", const_str);
printf("lower: %s\n", str1); free(str1);
printf("upper: %s\n", str2); free(str2);
printf("original string: %s\n", const_str);
printf("\nNon-constant string:\n");
char non_const_str[] = "Hello, user!";
printf("original string: %s\n", non_const_str);
printf("lower: %s\n", ascii_lowercase_strm(non_const_str));
printf("upper: %s\n", ascii_uppercase_strm(non_const_str));
printf("original string: %s\n", non_const_str);
return EXIT_SUCCESS;
}
#endif