crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
Strings.hpp File Reference
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <array>
#include <cctype>
#include <cstddef>
#include <ios>
#include <queue>
#include <random>
#include <sstream>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
Include dependency graph for Strings.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 crawlservpp::Helper::Strings
 Namespace for global string helper functions.
 

Constants

constexpr std::array crawlservpp::Helper::Strings::utfWhitespaces
 UTF-8 whitespaces used by utfTidy(). More...
 
constexpr auto crawlservpp::Helper::Strings::checkHexLength {3}
 Length of a two-digit hexademical number including the preceding percentage sign. More...
 
constexpr auto crawlservpp::Helper::Strings::randCharSet
 Characters to be chosen from for random string generation performed by generateRandom(). More...
 

Replacing

void crawlservpp::Helper::Strings::replaceAll (std::string &strInOut, std::string_view needle, std::string_view replacement)
 Replaces all occurences within a string with another string. More...
 

Conversion

bool crawlservpp::Helper::Strings::stringToBool (std::string inputString)
 Converts a string into a boolean value. More...
 

Number Format Checking

bool crawlservpp::Helper::Strings::isDec (std::string_view inputString)
 Checks whether a string contains only decimal digits and max. one dot (.). More...
 
bool crawlservpp::Helper::Strings::isHex (std::string_view inputString)
 Checks whether a string contains only hexadecimal digits. More...
 

Trimming

void crawlservpp::Helper::Strings::trim (std::string &stringToTrim)
 Removes whitespaces around a string. More...
 

Joining

std::string crawlservpp::Helper::Strings::join (const std::vector< std::string > &strings, char delimiter, bool ignoreEmpty)
 Concatenates all elements of a vector into a single string. More...
 
std::string crawlservpp::Helper::Strings::join (const std::vector< std::string > &strings, std::string_view delimiter, bool ignoreEmpty)
 Concatenates all elements of a vector into a single string. More...
 
std::string crawlservpp::Helper::Strings::join (std::queue< std::string > &strings, char delimiter, bool ignoreEmpty)
 Concatenates all elements of a queue into a single string. More...
 
std::string crawlservpp::Helper::Strings::join (std::queue< std::string > &strings, std::string_view delimiter, bool ignoreEmpty)
 Concatenates all elements of a queue into a single string. More...
 
void crawlservpp::Helper::Strings::join (const std::vector< std::string > &strings, char delimiter, bool ignoreEmpty, std::string &appendTo)
 Concatenates all elements of a vector and appends them to a string. More...
 
void crawlservpp::Helper::Strings::join (const std::vector< std::string > &strings, std::string_view delimiter, bool ignoreEmpty, std::string &appendTo)
 Concatenates all elements of a vector and appends them to a string. More...
 
void crawlservpp::Helper::Strings::join (std::queue< std::string > &strings, char delimiter, bool ignoreEmpty, std::string &appendTo)
 Concatenates all elements of a queue into a single string. More...
 
void crawlservpp::Helper::Strings::join (std::queue< std::string > &strings, std::string_view delimiter, bool ignoreEmpty, std::string &appendTo)
 Concatenates all elements of a queue into a single string. More...
 

Splitting

std::vector< std::string > crawlservpp::Helper::Strings::split (const std::string &str, char delimiter)
 Splits a string into a vector of strings using the given delimiter. More...
 
std::vector< std::string > crawlservpp::Helper::Strings::split (std::string_view str, std::string_view delimiter)
 Splits a string into a vector of strings using the given delimiter. More...
 
std::queue< std::string > crawlservpp::Helper::Strings::splitToQueue (std::string_view str, char delimiter, bool removeEmpty)
 Splits a string into a queue of strings using the given delimiter. More...
 
std::queue< std::string > crawlservpp::Helper::Strings::splitToQueue (std::string_view str, std::string_view delimiter, bool removeEmpty)
 Splits a string into a queue of strings using the given delimiter. More...
 

Sorting

void crawlservpp::Helper::Strings::sortAndRemoveDuplicates (std::vector< std::string > &vectorOfStrings, bool caseSensitive)
 Sorts the given vector of strings and removes duplicates. More...
 

Escape Characters

char crawlservpp::Helper::Strings::getFirstOrEscapeChar (std::string_view from)
 Gets the first character or an escaped character from the beginning of the given string. More...
 

Encoding

void crawlservpp::Helper::Strings::encodePercentage (std::string &stringToEncode)
 Encodes percentage signs that are not followed by a two-digit hexadecimal number with %25. More...
 

Tidying

void crawlservpp::Helper::Strings::utfTidy (std::string &stringToTidy)
 Removes new lines and unnecessary spaces, including UTF-8 whitespaces. More...
 

Name Checking

bool crawlservpp::Helper::Strings::checkDomainName (std::string_view name)
 Checks whether the given string is a a valid domain name. More...
 
bool crawlservpp::Helper::Strings::checkSQLName (std::string_view name)
 Checks whether the given string is a valid name for MySQL tables and fields. More...
 

Random String Generation

std::string crawlservpp::Helper::Strings::generateRandom (std::size_t length)
 Generates a random alpha-numerical string of the given length. More...