UFO 1.0.0
An Efficient Probabilistic 3D Mapping Framework That Embraces the Unknown
Loading...
Searching...
No Matches
string.hpp
1
41#ifndef UFO_UTILITY_STRING_HPP
42#define UFO_UTILITY_STRING_HPP
43
44// STL
45#include <cctype>
46#include <string>
47#include <vector>
48
49namespace ufo
50{
57[[nodiscard]] std::vector<std::string> split(std::string const& s, char delimiter);
58
65[[nodiscard]] std::string join(std::vector<std::string> const& strings, char delimiter);
66
73[[nodiscard]] bool startsWith(std::string const& s, std::string const& prefix);
74
81[[nodiscard]] bool endsWith(std::string const& s, std::string const& suffix);
82
89[[nodiscard]] bool contains(std::string const& s, std::string const& sub);
90
96[[nodiscard]] std::string tolower(std::string s);
97
103[[nodiscard]] std::string toupper(std::string s);
104
109void ltrim(std::string& s);
110
115void rtrim(std::string& s);
116
121void trim(std::string& s);
122
128[[nodiscard]] std::string ltrimCopy(std::string s);
129
135[[nodiscard]] std::string rtrimCopy(std::string s);
136
142[[nodiscard]] std::string trimCopy(std::string s);
143} // namespace ufo
144
145#endif // UFO_UTILITY_STRING_HPP
All vision-related classes and functions.
Definition cloud.hpp:49
std::vector< std::string > split(std::string const &s, char delimiter)
Splits a string into a vector of substrings using a delimiter.
Definition string.cpp:51
void ltrim(std::string &s)
Removes leading whitespace from the string (in-place).
Definition string.cpp:106
bool startsWith(std::string const &s, std::string const &prefix)
Checks if a string starts with a given prefix.
Definition string.cpp:76
bool endsWith(std::string const &s, std::string const &suffix)
Checks if a string ends with a given suffix.
Definition string.cpp:81
void rtrim(std::string &s)
Removes trailing whitespace from the string (in-place).
Definition string.cpp:112
std::string toupper(std::string s)
Converts all characters in the string to uppercase.
Definition string.cpp:99
std::string join(std::vector< std::string > const &strings, char delimiter)
Joins a vector of strings into a single string with a delimiter.
Definition string.cpp:62
std::string ltrimCopy(std::string s)
Returns a copy of the string with leading whitespace removed.
Definition string.cpp:126
std::string tolower(std::string s)
Converts all characters in the string to lowercase.
Definition string.cpp:92
std::string trimCopy(std::string s)
Returns a copy of the string with leading and trailing whitespace removed.
Definition string.cpp:138
std::string rtrimCopy(std::string s)
Returns a copy of the string with trailing whitespace removed.
Definition string.cpp:132
constexpr bool contains(A const &a, B const &b)
Checks if a shape contains another shape.
Definition contains.hpp:63
void trim(std::string &s)
Removes leading and trailing whitespace from the string (in-place).
Definition string.cpp:120