From fdc79a6b125d52b6ca0fd65df538db7810d88a8d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 8 Apr 2020 08:32:56 -0600 Subject: lib: Add a function to convert a string to upper case Add a helper function for this operation. Update the strtoul() tests to check upper case as well. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- lib/strto.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/strto.c b/lib/strto.c index 606701566f3..3d77115d4d8 100644 --- a/lib/strto.c +++ b/lib/strto.c @@ -179,3 +179,11 @@ long trailing_strtol(const char *str) { return trailing_strtoln(str, NULL); } + +void str_to_upper(const char *in, char *out, size_t len) +{ + for (; len > 0 && *in; len--) + *out++ = toupper(*in++); + if (len) + *out = '\0'; +} -- cgit v1.3.1