Go to the documentation of this file.
33 const auto i = str.find_last_of(
"./");
35 if (i == npos || i == 0 || str[i] ==
'/')
46 return find_ext(*
this);
52 return (npos !=
find(
'/'));
58 return (npos != find_ext());
64 const auto i = rfind(
'/');
78 const auto i = find_ext();
101 std::
string(std::move(str))
131 template<
class String>
134 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
136 if (!String::valid(*iter))
146 template<
class String>
149 if (!valid<String>(str))
152 iterator outIter = str.begin();
154 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
156 const char c = *iter;
158 if (String::valid(
c))
175 template<
class String>
179 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
181 const char c = *iter;
182 if (quote &&
c == quote)
190 else if (String::meta(
c))
199 template<
class String>
209 sQuoted.reserve(2*str.size());
212 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
214 const char c = *iter;
223 else if (String::meta(
c))
231 sQuoted.shrink_to_fit();
237 template<
class String>
241 out.resize(str.size());
244 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
246 const char c = *iter;
247 if (String::valid(
c))
262 return !compare(text);
271 std::string::swap(str);
280 return !compare(text);
284 inline unsigned Foam::string::hash::operator()
286 const std::string& str,
290 return Hasher(str.data(), str.size(), seed);
std::string::size_type find_ext() const
Find position of a file extension dot, return npos on failure.
bool hasExt() const
Return true if it has an extension or simply ends with a '.'.
bool removeExt()
Remove extension, returning true if string changed.
unsigned Hasher(const void *data, size_t len, unsigned seed=0)
Bob Jenkins's 96-bit mixer hashing function (lookup3)
bool operator()(const std::string &text) const
Test for equality. Allows use as a predicate.
A class for handling character strings derived from std::string.
bool match(const std::string &text) const
Test for equality.
static String validate(const std::string &str)
Return a valid String from the given string.
graph_traits< Graph >::vertices_size_type size_type
bool hasPath() const
Return true if it contains a '/' character.
static bool valid(const std::string &str)
Does the string contain valid characters only?
label find(const ListType &input, const UnaryPredicate &pred, const label start=0)
Find index of the first occurrence that satisfies the predicate.
bool removePath()
Remove leading path, returning true if string changed.
static bool meta(const std::string &str, const char quote='\\')
Does this string contain meta-characters?
static bool stripInvalid(std::string &str)
Strip invalid characters from the given string.
string()=default
Construct null.
const dimensionedScalar c
Speed of light in a vacuum.
void swap(std::string &str)
Swap contents. Self-swapping is a no-op.
static string quotemeta(const std::string &str, const char quote='\\')
Return a String with quoted meta-characters from the given string.