diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-28 05:37:15 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-28 05:37:42 +0200 |
commit | 1b7abc7e819d055b3d0ea5be8967a1e381bb5d60 (patch) | |
tree | 503e6f67d933119df4512ef7186ed380b393f868 /src/StringUtils.cpp | |
parent | f045e579e1faa186ca0ebf6e6d1e562fbcd75727 (diff) |
Add youtube subscriptions, etc
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r-- | src/StringUtils.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp index 56d746c..84e2ce5 100644 --- a/src/StringUtils.cpp +++ b/src/StringUtils.cpp @@ -16,6 +16,17 @@ namespace QuickMedia { } } + size_t string_replace_all(std::string &str, char old_char, char new_char) { + size_t num_replaced_substrings = 0; + for(char &c : str) { + if(c == old_char) { + c = new_char; + ++num_replaced_substrings; + } + } + return num_replaced_substrings; + } + size_t string_replace_all(std::string &str, char old_char, const std::string &new_str) { size_t num_replaced_substrings = 0; size_t index = 0; |