33 const auto i = str.find_last_of(
"./");
35 if (i == npos || i == 0 || str[i] ==
'/')
52 return (std::string::npos !=
find_ext());
58 const auto n1 = size();
59 const auto n2 = strlen(ending);
65 &&
operator[](n1-n2-1) ==
'.'
66 && !compare(n1-n2, npos, ending, n2)
73 const auto n1 = size();
74 const auto n2 = ending.size();
80 &&
operator[](n1-n2-1) ==
'.'
81 && !compare(n1-n2, npos, ending)
88 const auto i = rfind(
'/');
102 const auto i = find_ext();
125 std::
string(std::move(str))
155template<
class StringType>
158 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
160 if (!StringType::valid(*iter))
170template<
class StringType>
176 iterator outIter = str.begin();
178 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
180 const char c = *iter;
182 if (StringType::valid(c))
199template<
class StringType>
203 out.resize(str.size());
206 for (
auto iter = str.cbegin(); iter != str.cend(); ++iter)
208 const char c = *iter;
209 if (StringType::valid(c))
226 return !compare(text);
235 std::string::swap(str);
244 return !compare(text);
graph_traits< Graph >::vertices_size_type size_type
static bool valid(const std::string &str)
Does the string contain valid characters only?
bool remove_ext()
Remove extension, return true if string changed.
string()=default
Default construct.
static bool stripInvalid(std::string &str)
Strip invalid characters from the given string.
std::string::size_type find_ext() const
Find position of a file extension dot, return npos on failure.
bool match(const std::string &text) const
Test for equality.
static StringType validate(const std::string &str)
Return a valid String from the given string.
bool remove_path()
Remove leading path, return true if string changed.
bool has_ext() const
Return true if it has an extension or simply ends with a '.'.
bool operator()(const std::string &text) const
Test for equality. Allows use as a predicate.
void swap(std::string &str)
Swap contents. Self-swapping is a no-op.
static std::string::size_type find_ext(const std::string &str)
Find position of a file extension dot, return npos on failure.