redesign, broadcast server crash fix
This commit is contained in:
@@ -126,6 +126,16 @@ std::string StringUtils::removeNotAscii(std::string str)
|
||||
return str;
|
||||
}
|
||||
|
||||
std::string StringUtils::elide(const std::string& s, size_t maxChars)
|
||||
{
|
||||
if (s.size() <= maxChars || maxChars < 6) return s;
|
||||
constexpr const char* dots = "...";
|
||||
size_t budget = maxChars - 3;
|
||||
size_t head = (budget + 1) / 2;
|
||||
size_t tail = budget - head;
|
||||
return s.substr(0, head) + dots + s.substr(s.size() - tail);
|
||||
}
|
||||
|
||||
HidsysNotificationLedPattern blinkLedPattern(u8 times)
|
||||
{
|
||||
HidsysNotificationLedPattern pattern;
|
||||
|
||||
Reference in New Issue
Block a user