Skip to content

Instantly share code, notes, and snippets.

@DrewFitz
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DrewFitz/6532ddfdc65bdf0f7e7a to your computer and use it in GitHub Desktop.
Save DrewFitz/6532ddfdc65bdf0f7e7a to your computer and use it in GitHub Desktop.
Who likes unicode allcaps???
/*
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