mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
committed by
Konstantin Pastbin
parent
3f7815017e
commit
3c34765595
@@ -114,6 +114,20 @@ void Trim(std::string_view & sv);
|
||||
void Trim(std::string_view & s, std::string_view anyOf);
|
||||
void Trim(std::string & s, std::string_view anyOf);
|
||||
|
||||
template <std::convertible_to<std::string_view> Utf8>
|
||||
size_t CountChar(Utf8 const & utf8)
|
||||
{
|
||||
size_t codePoints = 0;
|
||||
|
||||
for (auto const c : utf8)
|
||||
{
|
||||
if ((c & 0xC0) != 0x80)
|
||||
++codePoints;
|
||||
}
|
||||
|
||||
return codePoints;
|
||||
}
|
||||
|
||||
bool Truncate(std::string & utf8, size_t const maxTextLengthPlus1);
|
||||
|
||||
// Replace the first match of the search substring in the input with the format string.
|
||||
|
||||
Reference in New Issue
Block a user