10 #ifndef STRINGHELPER_HPP_
11 #define STRINGHELPER_HPP_
41 std::vector<std::string>
tokenize(
const std::string& str,
char delimiter,
bool unique =
false,
bool leaveEmptyTokens =
true);
49 bool contains(
const std::vector<std::string>& vec,
const std::string& str);
57 bool beginsWith (
const std::string& str,
const std::string& substr);
65 bool endsWith (
const std::string& str,
const std::string& substr );
81 void substituteAll (std::string& str,
const std::string& from,
const std::string& to);
92 std::string
cut(
const std::string& str,
const std::string& begin,
const std::string& end, std::string::size_type& pos);
106 std::vector<std::string>
parserURL(
const std::string& url);
140 #endif // STRINGHELPER_HPP_
bool contains(const std::vector< std::string > &vec, const std::string &str)
Checks if given string is contained in vector of strings.
Definition: StringHelper.cpp:16
bool getUnfoldedLine(std::istream &is, std::string &str)
Definition: StringHelper.cpp:220
void trimWhitespaces(std::string &str)
Removes whitespaces from beginning and end of given string.
Definition: StringHelper.cpp:29
std::string cut(const std::string &str, const std::string &begin, const std::string &end, std::string::size_type &pos)
Cuts part of string contained between two substrings.
Definition: StringHelper.cpp:92
std::string parseURLHostPart(const std::string &url)
Parses host part out of URL.
Definition: StringHelper.cpp:174
void eraseAllOccurences(std::string &str, char toRemove)
Removes all occurences of given character from string.
Definition: StringHelper.cpp:87
void unquoteSpecialCharacters(std::string &str)
Removes quotation of special characters e.g. converts "\," into ",".
Definition: StringHelper.cpp:255
void linearize(std::string &str)
Unfolds all lines in provided string. check if it does not duplicates functionality from getUnfoldedL...
Definition: StringHelper.cpp:242
void substituteAll(std::string &str, const std::string &from, const std::string &to)
Substitutes all occurrences of given substring.
Definition: StringHelper.cpp:190
void trimSpaces(std::string &str)
Removes whitespaces and spaces from beginning and end of given string.
Definition: StringHelper.cpp:40
std::vector< std::string > tokenize(const std::string &str, char delimiter, bool unique, bool leaveEmptyTokens)
Tokenizes string. Uses provided delimiter for tokens, process can be controlled by behavior in case o...
Definition: StringHelper.cpp:51
bool beginsWith(const std::string &str, const std::string &substr)
Checks if given string begins with given substring.
Definition: StringHelper.cpp:202
std::vector< std::string > parserURL(const std::string &url)
Parses URL into parts. URL is parsed into four parts: scheme (http, https, ftp, etc.), host, path and query, eg. http://www.google.com/search?q=test will be parsed into:
Definition: StringHelper.cpp:124
bool endsWith(const std::string &str, const std::string &substr)
Checks if given string ends with given substring.
Definition: StringHelper.cpp:211
std::string percentDecode(const std::string &uri)
Definition: StringHelper.cpp:272