23 lines
758 B
C++
23 lines
758 B
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace StringUtil {
|
|
|
|
std::string lower(const std::string& text);
|
|
std::string trim(const std::string& text);
|
|
bool equalsIgnoreCase(const std::string& a, const std::string& b);
|
|
bool startsWithIgnoreCase(const std::string& text, const std::string& prefix);
|
|
std::string join(const std::vector<std::string>& parts, std::size_t from, const std::string& separator);
|
|
|
|
// Number of characters (UTF-8 code points) in the text.
|
|
std::size_t displayWidth(const std::string& text);
|
|
|
|
// Collapses line breaks into " / ". If `maxChars` > 0 the text is cut to that
|
|
// many characters; 0 means no limit.
|
|
std::string singleLine(const std::string& text, std::size_t maxChars);
|
|
|
|
} // namespace StringUtil
|