Last active
August 29, 2015 14:10
-
-
Save DrewFitz/6532ddfdc65bdf0f7e7a to your computer and use it in GitHub Desktop.
Who likes unicode allcaps???
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Compile: make mathcaps | |
Usage: ./mathcaps "the string to convert" | |
*/ | |
#include <stdio.h> | |
#include <string.h> | |
int main(int argc, char** argv) { | |
char* s = argv[1]; | |
int len = strlen(s); | |
for (int i = 0; i < len; ++i) | |
{ | |
if (s[i] == ' ') { | |
printf(" "); | |
continue; | |
} | |
char c = s[i] - 'a'; | |
if (c < 0) c = s[i] - 'A'; | |
if (c < 0 || c > 25) continue; | |
printf("\xF0\x9D\x90%c", 0x80+c); | |
} | |
printf("\n"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment