From 47cebef7a2e4dd66be9f7f6b0b8e8cadfeb6064a Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Tue, 31 Dec 2019 10:32:47 +0100 Subject: add strlen implementation --- strings.c | 8 ++++++++ strings.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/strings.c b/strings.c index fb3b0ac..7c87e29 100644 --- a/strings.c +++ b/strings.c @@ -71,3 +71,11 @@ void uint32_to_hexstringt(uint32_t number, char buf[9]) trim_0s(buf); } +size_t strlen(char string[]) +{ + size_t len; + + for (len = 0; string[len]; len++); + + return len; +} diff --git a/strings.h b/strings.h index bfe6fd0..7e772d3 100644 --- a/strings.h +++ b/strings.h @@ -21,4 +21,6 @@ void uint32_to_decstringt(uint32_t number, char buf[11]); void uint32_to_hexstringt(uint32_t number, char buf[9]); +size_t strlen(char string[]); + #endif // STRINGS_H -- cgit v1.2.3