3#include <boost/algorithm/string/case_conv.hpp>
7#include "boost/algorithm/string/classification.hpp"
8#include "boost/algorithm/string/split.hpp"
19 boost::algorithm::split(tokens, text, boost::algorithm::is_space());
23 while (text[length] ==
' ') {
27 for (
int i = 0; i < static_cast<int>(tokens.
size()) - 1; i++) {
28 length +=
static_cast<int>(tokens[i].length());
30 if (length +
static_cast<int>(tokens[i + 1].length()) + 1 > linewidth) {
32 for (
int ws = 0; ws < indentation; ws++) {
41 wrapped += tokens.
back();
49 size_t pos = filename.
rfind(extension);
50 if ((pos == std::string::npos) || (pos != filename.
size() - extension.
size())) {
51 filename += extension;
59 boost::algorithm::to_lower(str);
60 if (str ==
"1" or str ==
"yes" or str ==
"true" or str ==
"on")
71 for (
size_t i = 0; i != wstr.
length(); ++i) {
74 converted[i] = (ret == 1) ? mb.
front() : fill;
82 using Matrix = Eigen::Matrix<std::size_t, Eigen::Dynamic, Eigen::Dynamic>;
83 Matrix distances(len1 + 1, len2 + 1);
93 auto deletionCost = distances(i - 1, j) + 1;
94 auto insertionCost = distances(i, j - 1) + 1;
95 auto substitutionCost = distances(i - 1, j - 1) + (s1[i - 1] == s2[j - 1] ? 0 : 1);
96 distances(i, j) =
std::min({deletionCost, insertionCost, substitutionCost});
100 return distances(len1, len2);
105 std::regex kebabCaseRegex(
"^[a-z0-9]+(-[a-z0-9]+)*$");
#define PRECICE_ASSERT(...)
contains precice-related utilities.
bool isKebabStyle(std::string_view sv)
std::size_t editDistance(std::string_view s1, std::string_view s2)
bool convertStringToBool(std::string const &value)
Evaluates a string to find out if it represents a bool.
std::string truncate_wstring_to_string(std::wstring wstr, char fill)
std::string wrapText(const std::string &text, int linewidth, int indentation)
std::string & checkAppendExtension(std::string &filename, const std::string &extension)
Checks if filename has the given extension, if not appends it.