5 #ifndef BPP_TEXT_TEXTTOOLS_H 6 #define BPP_TEXT_TEXTTOOLS_H 25 bool isEmpty(
const std::string& s);
31 std::string
toUpper(
const std::string& s);
37 std::string
toLower(
const std::string& s);
100 bool isDecimalNumber(
const std::string& s,
char dec =
'.',
char scientificNotation =
'e');
117 std::ostringstream oss;
130 std::ostringstream oss;
131 oss << std::setprecision(precision) << t;
142 std::istringstream iss(s);
154 int toInt(
const std::string& s,
char scientificNotation =
'e');
163 double toDouble(
const std::string& s,
char dec =
'.',
char scientificNotation =
'e');
170 T
to(
const std::string& s)
172 std::istringstream iss(s);
186 std::string
resizeRight(
const std::string& s,
size_t newSize,
char fill =
' ');
195 std::string
resizeLeft(
const std::string& s,
size_t newSize,
char fill =
' ');
203 std::vector<std::string>
split(
const std::string& s,
size_t n);
215 std::string
removeSubstrings(
const std::string& s,
char blockBeginning,
char blockEnding);
231 std::string
removeSubstrings(
const std::string& s,
char blockBeginning,
char blockEnding,
232 std::vector<std::string>& exceptionsBeginning,
233 std::vector<std::string>& exceptionsEnding);
242 std::string
removeChar(
const std::string& s,
char c);
251 std::size_t
count(
const std::string& s,
const std::string& pattern);
260 bool startsWith(
const std::string& s,
const std::string& pattern);
269 bool endsWith(
const std::string& s,
const std::string& pattern);
278 bool hasSubstring(
const std::string& s,
const std::string& pattern);
287 void replaceAll(std::string& target,
const std::string& query,
const std::string& replacement);
290 #endif // BPP_TEXT_TEXTTOOLS_H std::string resizeRight(const std::string &s, std::size_t newSize, char fill)
void replaceAll(std::string &target, const std::string &query, const std::string &replacement)
Replacement of all non-overlapping occurrences of a certain motif in a string.
bool isDecimalNumber(char c)
Tell is a given character describes a decimal number.
double toDouble(const std::string &s, char dec, char scientificNotation)
Convert from string to double.
T to(const std::string &s)
Template to string conversion.
std::size_t count(const std::string &s, const std::string &pattern)
Count the occurences of a given pattern in a string.
std::string removeLastNewLines(const std::string &s)
Remove all new line characters at the end of a string.
std::string removeChar(const std::string &s, char c)
Remove all occurences of a character in a string.
std::string removeSurroundingWhiteSpaces(const std::string &s)
Remove all white spaces characters at the beginning and the end of a string.
std::string toLower(const std::string &s)
Make the string lowercase.
std::string removeWhiteSpaces(const std::string &s)
Remove all white spaces characters in a string.
T fromString(const std::string &s)
General template method to convert from string.
std::string removeFirstWhiteSpaces(const std::string &s)
Remove all white spaces characters at the beginning of a string.
bool isNewLineCharacter(char c)
Tell if a character is a new line character or not.
std::string resizeLeft(const std::string &s, std::size_t newSize, char fill)
std::string removeNewLines(const std::string &s)
Remove all new line characters in a string.
std::string removeLastWhiteSpaces(const std::string &s)
Remove all white spaces characters at the end of a string.
int toInt(const std::string &s, char scientificNotation)
Convert from string to int.
bool hasSubstring(const std::string &s, const std::string &pattern)
Tell is a string contains a certain motif.
bool isWhiteSpaceCharacter(char c)
Tell if a character is a white space or not.
std::string toUpper(const std::string &s)
Make the string uppercase.
bool isEmpty(const std::string &s)
Tell if a string is empty. A string is considered to be 'empty' if it is only made of white spaces...
std::string toString(T t)
General template method to convert to a string.
bool isDecimalInteger(const std::string &s, char scientificNotation)
Tell is a given character string describes a decimal integer. FIXME: for now, this parser will not re...
bool endsWith(const std::string &s, const std::string &pattern)
Tell is a string ends with a certain motif.
bool startsWith(const std::string &s, const std::string &pattern)
Tell is a string begins with a certain motif.
std::string removeSubstrings(const std::string &s, char blockBeginning, char blockEnding)
Remove substrings from a string. All substrings beginning with blockBeginning and ending with blockEn...
std::vector< std::string > split(const std::string &s, std::size_t n)