summaryrefslogtreecommitdiff
path: root/csrc
diff options
context:
space:
mode:
authorIru Cai <mytbk920423@gmail.com>2018-09-06 01:09:53 +0800
committerIru Cai <mytbk920423@gmail.com>2018-09-06 01:09:53 +0800
commit77fe843b3cae6b6e03190e1a9eb99b6424f56ef4 (patch)
tree8b726ae8d4fe06b8efc4fd600d6e896c3037e6c1 /csrc
parent2994c250e9dea8102c859550514404ce50bb96d5 (diff)
downloadrich4-77fe843b3cae6b6e03190e1a9eb99b6424f56ef4.tar.xz
strcpy_without_spaces
Diffstat (limited to 'csrc')
-rw-r--r--csrc/util.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/csrc/util.c b/csrc/util.c
new file mode 100644
index 0000000..5a2915e
--- /dev/null
+++ b/csrc/util.c
@@ -0,0 +1,16 @@
+#include <string.h>
+
+void strcpy_without_spaces(char * a1, const char * a2)
+{
+ size_t j = 0;
+ size_t L = strlen(a2);
+
+ for (size_t i = 0; i < L; i++) {
+ if (a2[i] == ' ') {
+ continue;
+ }
+ a1[j] = a2[i];
+ j++;
+ }
+ a1[j] = 0;
+}