Skip to content

Commit 34e9278

Browse files
committed
fdsdump: add string_to_lower to common funcs
1 parent a165632 commit 34e9278

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/tools/fdsdump/src/common/common.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ string_trim_copy(std::string str)
9999
return str;
100100
}
101101

102+
std::string
103+
string_to_lower(std::string str)
104+
{
105+
std::for_each(str.begin(), str.end(), [](char &c) { c = std::tolower(c); });
106+
return str;
107+
}
108+
102109
void
103110
memcpy_bits(uint8_t *dst, uint8_t *src, unsigned int n_bits)
104111
{

src/tools/fdsdump/src/common/common.hpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ string_trim(std::string &str);
6161
std::string
6262
string_trim_copy(std::string str);
6363

64+
65+
/**
66+
* @brief Convert a string to lowercase
67+
*
68+
* @param The string to convert
69+
*
70+
* @return The supplied string converted to lowercase
71+
*/
72+
std::string
73+
string_to_lower(std::string str);
74+
6475
/**
6576
* @brief Copy a specified number of bits from source to destination,
6677
* remaining bits in an incomplete byte are zeroed.

0 commit comments

Comments
 (0)