mirror of
https://github.com/rad4day/Waybar.git
synced 2023-12-21 10:22:59 +01:00
remove duplicated string manipulation methods
This commit is contained in:
parent
2697d432a4
commit
f3819ee954
@ -4,6 +4,7 @@
|
||||
#include "glibmm/fileutils.h"
|
||||
#include "glibmm/refptr.h"
|
||||
#include "util/format.hpp"
|
||||
#include "util/string.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
@ -26,27 +27,6 @@
|
||||
|
||||
namespace waybar::modules::wlr {
|
||||
|
||||
/* String manipulation methods */
|
||||
const std::string WHITESPACE = " \n\r\t\f\v";
|
||||
|
||||
static std::string ltrim(const std::string& s)
|
||||
{
|
||||
size_t start = s.find_first_not_of(WHITESPACE);
|
||||
return (start == std::string::npos) ? "" : s.substr(start);
|
||||
}
|
||||
|
||||
static std::string rtrim(const std::string& s)
|
||||
{
|
||||
size_t end = s.find_last_not_of(WHITESPACE);
|
||||
return (end == std::string::npos) ? "" : s.substr(0, end + 1);
|
||||
}
|
||||
|
||||
static std::string trim(const std::string& s)
|
||||
{
|
||||
return rtrim(ltrim(s));
|
||||
}
|
||||
|
||||
|
||||
/* Icon loading functions */
|
||||
static std::vector<std::string> search_prefix()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user