From a080f71eb44563e98c88ded24b7397dad4f71b6b Mon Sep 17 00:00:00 2001 From: Raymond Chow Date: Sat, 27 May 2017 17:41:28 +1000 Subject: [PATCH] Uploaded files --- README.md | 16 ++++++++++++- discord.c | 54 +++++++++++++++++++++++++++++++++++++++++++ images/converted.png | Bin 0 -> 2024 bytes slack.c | 54 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 discord.c create mode 100644 images/converted.png create mode 100644 slack.c diff --git a/README.md b/README.md index fc09ba4..a78ad55 100644 --- a/README.md +++ b/README.md @@ -1 +1,15 @@ -discord-text-to-emoji +# Discord Text to Emoji # + +This program converts a string to emojis in Discord, and automatically copies the result to clipboard. It accepts alphanumeric strings. If a non-alphanumeric character is inputted, it will simply spit out **:regional\_indicator\_:** For example: + +**abc 123** + +will become + +**:regional\_indicator\_a: :regional\_indicator\_b: :regional\_indicator\_c: :one: :two: :three:** + +which displays as + +![Converted text](/images/converted.png) + +The binaries are compiled using Mingw-w64 for 64-bit Windows. \ No newline at end of file diff --git a/discord.c b/discord.c new file mode 100644 index 0000000..cfa489e --- /dev/null +++ b/discord.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include +//#include + +int main() { + char output[1000] = ""; + char prefix[21] = ":regional_indicator_"; + char *numbers[] = {":zero:\0", ":one:\0", ":two:\0", ":three:\0", ":four:\0", ":five:\0", ":six:\0", ":seven:\0", ":eight:\0", ":nine:\0"}; + + char input[1000]; + printf("Please input the string to be converted: "); + fgets(input, 1000, stdin); + + long length = (long) strlen(input); + for (int i = 0; i < length - 1; i++) { + if (isdigit((input[i]))) { + char *current; + current = malloc(sizeof(int) * 2); + current[0] = input[i]; + current[1] = '\0'; + + int digit; + digit = atoi(current); + + char src[12]; + strcpy(src, numbers[digit]); + strcat(output, src); + strcat(output, " "); + } + else { + if (input[i] == ' ') { + strcat(output, " "); + } + else { + char current[2]; + current[0] = (char) tolower(input[i]); + strcat(output, prefix); + strcat(output, current); + strcat(output, ": "); + } + } + } + + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, 1001); + memcpy(GlobalLock(hMem), output, 1001); + GlobalUnlock(hMem); + OpenClipboard(0); + EmptyClipboard(); + SetClipboardData(CF_TEXT, hMem); + CloseClipboard(); +} diff --git a/images/converted.png b/images/converted.png new file mode 100644 index 0000000000000000000000000000000000000000..73b42df37929eab87809190b1beb76817f915959 GIT binary patch literal 2024 zcmZ8ic{rQd8jq?f##m}=bsqcHYF&iZ5=-nNDzT2WR6i1*-ljWlrRhi z6Lqk+#zHFx8fT6lgXU=QbK20t7lpM$!s>=jFGHK7A(m)M80>ML$o~TcpuNz~_CH3! zVBh!f247!9bubJjnBZV-=@#qH`VCR*XCrl+>y8v3otoU`-xSp5-{Z$l*4)bx_C7AN zoP96HR$I!|T1xV9Te1RQ)@O{b%f;E9$O|#PrqqzZ)goq8B=E$leWXIkM8!A}<93R&v9l)9ubx%hQH|1BhVbRixSke{{$%8t4* zRwX|(-_D7lZbY%0ysp=%H^;2cN07q%J}-SJ&C0fcey$uAxi@4^-*2akN1G;Y?#vJM zy6njgmT1<;sE0vB*hr1he zIt5$l6h^w<#m9emtx)gnoF?p4Dv<)cF{ezn3XDbS%x#rB@GdJSmY8Y&c2TysoQVC2 zLEiZ-b2b6FJ^{YD-Kvn9Ux^1ug zH|d=s4jXi6JeNV&&v3s`K3(5lJz=hz-DSN-b^s|w3E^WmcCz$oAvsudO96MUZ+C(I zEMRfppSx`w37mvNJke;Fj3RA2)QU!9_h{k=ptp~;c-hVNthThE1|6={n_2SbZ$H~Z z4jHDv-SvqOU84JSzYES#ZEMt}&wOVxd}EVUP(QsMnga@x=h*&Npi&l9HD?@n}A(MUGsP$z)je@wc$Nwv)=*WMsk=FI%*UYq!9l!-fP;13f%lOP`U3R77n}dy0WYBA-#C`S%juJ#L z2^*Lsz#0UcF%+$TLN2BHj^ zhF0c8!&!t)o={Rl?Yx>}%MCJ)%4FU0^wK;>dfNZv3le@4^i!!iR&ihXS9QyFCBw+> zmuO4S+ajDO$5_=PAy5MhTb^_uuu6~toeSFY0=TJQ0&zp?{JiXHS5H_S7VS^fQR2?_ zSV3H0c-9N&d;vVon|zFkj_bD|vd~IaI)Vhl$h{gxbn&ZeVuqpbTTpQkb~=pU!Mg4+ zCe0${77#~Qw1!T(J!!b8mw1ypEnQO{EUpe^0HRuf;=iIoD1Wv4{M2aE!0I+P_zW!> zWe}JBP+~OqL5VE-z%Tb6XWB)Jm!aWe6-9mtPi==}^i!eZ2mj69@bM^n4&?oy9{ZHK zuQ{ShqlOOrggS7O&R33UZ~IEPD)n`zCPU>wHG4@dlFIKh7JO3GOu26Pl|j_L?@ySP z5tsF?9N|Ls8K_Kq9zZA#@RW>yGP{)}b;vvB)wO6%N9PVJ9tvtwBd8WJ9YN6ToVoNa z)z~-zu+LDR*X=~uxitCqiYzyj8Pno-I`s+#}N$r5CRNrK1mZ%Og`yCUIBGXjv#!Z0@*3jXk}&fPXT%F7A52LCtIHUGb)N1?X38SR-V?kIb24YwL9yKLDaK zHe_rxJ$II7-86<6Qp)^c?DR6WfoAM~)|8-I4`hUXC(7ciMt{?gQ!oF2^8JB5MI^vkl1&=wFnTPCqb(DN3+nvvnBR9poBpNCYk{}TRh#&R$0je6Z-f674i2Dl>~Jt zS=kGpPM4jxBR3z({JTTSviAi}uwEQc2$VWGr{dTH@2vl6CKspe!;D?v^<$a49Z+|M NIoLQ`*C8(_{{@*7;GO^g literal 0 HcmV?d00001 diff --git a/slack.c b/slack.c new file mode 100644 index 0000000..2c3fcbf --- /dev/null +++ b/slack.c @@ -0,0 +1,54 @@ +#include +#include +#include +#include +#include +//#include + +int main() { + char output[1000] = ""; + char prefix[9] = ":letter_"; + char *numbers[] = {":zero:\0", ":one:\0", ":two:\0", ":three:\0", ":four:\0", ":five:\0", ":six:\0", ":seven:\0", ":eight:\0", ":nine:\0"}; + + char input[1000]; + printf("Please input the string to be converted: "); + fgets(input, 1000, stdin); + + long length = (long) strlen(input); + for (int i = 0; i < length - 1; i++) { + if (isdigit((input[i]))) { + char *current; + current = malloc(sizeof(int) * 2); + current[0] = input[i]; + current[1] = '\0'; + + int digit; + digit = atoi(current); + + char src[12]; + strcpy(src, numbers[digit]); + strcat(output, src); + strcat(output, " "); + } + else { + if (input[i] == ' ') { + strcat(output, " "); + } + else { + char current[2]; + current[0] = (char) tolower(input[i]); + strcat(output, prefix); + strcat(output, current); + strcat(output, ": "); + } + } + } + + HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, 1001); + memcpy(GlobalLock(hMem), output, 1001); + GlobalUnlock(hMem); + OpenClipboard(0); + EmptyClipboard(); + SetClipboardData(CF_TEXT, hMem); + CloseClipboard(); +}