3#include <boost/algorithm/string/case_conv.hpp>
6#include "boost/algorithm/string/classification.hpp"
7#include "boost/algorithm/string/split.hpp"
18 boost::algorithm::split(tokens, text, boost::algorithm::is_space());
22 while (text[length] ==
' ') {
26 for (
int i = 0; i < static_cast<int>(tokens.
size()) - 1; i++) {
27 length +=
static_cast<int>(tokens[i].length());
29 if (length +
static_cast<int>(tokens[i + 1].length()) + 1 > linewidth) {
31 for (
int ws = 0; ws < indentation; ws++) {
40 wrapped += tokens.
back();
48 size_t pos = filename.
rfind(extension);
49 if ((pos == std::string::npos) || (pos != filename.
size() - extension.
size())) {
50 filename += extension;
58 boost::algorithm::to_lower(str);
59 if (str ==
"1" or str ==
"yes" or str ==
"true" or str ==
"on")
70 for (
size_t i = 0; i != wstr.
length(); ++i) {
73 converted[i] = (ret == 1) ? mb.
front() : fill;
81 using Matrix = Eigen::Matrix<std::size_t, Eigen::Dynamic, Eigen::Dynamic>;
82 Matrix distances(len1 + 1, len2 + 1);
92 auto deletionCost = distances(i - 1, j) + 1;
93 auto insertionCost = distances(i, j - 1) + 1;
94 auto substitutionCost = distances(i - 1, j - 1) + (s1[i - 1] == s2[j - 1] ? 0 : 1);
95 distances(i, j) =
std::min({deletionCost, insertionCost, substitutionCost});
99 return distances(len1, len2);
#define PRECICE_ASSERT(...)
contains precice-related utilities.
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.