commit 4aa6a2c239e36027a7174b274d9d8bc9beeac8e3
parent e2343a842d131ef3b3148524f48d9776635c76ba
Author: finwo <finwo@pm.me>
Date: Sun, 19 May 2024 01:52:01 +0200
Added strtoupper method
Diffstat:
4 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/package.ini b/package.ini
@@ -1,8 +1,10 @@
[export]
config.mk=config.mk
+
include/finwo/str_extra.h=src/str_extra.h
include/finwo/str_isHex.h=src/str_isHex.h
include/finwo/strnstr.h=src/strnstr.h
+include/finwo/strtoupper.h=src/strtoupper.h
[package]
deps=lib
diff --git a/src/str_extra.h b/src/str_extra.h
@@ -3,5 +3,6 @@
#include "str_isHex.h"
#include "strnstr.h"
+#include "strtoupper.h"
#endif // __FINWO_STREXTRA_H__
diff --git a/src/strtoupper.c b/src/strtoupper.c
@@ -0,0 +1,11 @@
+#include <ctype.h>
+
+#include "strtoupper.h"
+
+char * strtoupper(char *str) {
+ char *ref = str;
+ for(;*ref;++ref) {
+ *ref=toupper((unsigned char)*ref);
+ }
+ return str;
+}
diff --git a/src/strtoupper.h b/src/strtoupper.h
@@ -0,0 +1,6 @@
+#ifndef __FINWO_STREXTRA_STRTOUPPER_H__
+#define __FINWO_STREXTRA_STRTOUPPER_H__
+
+char * strtoupper(char *str);
+
+#endif // __FINWO_STREXTRA_STRTOUPPER_H__