![]() |
LogDoctor 2.04
Parse Apache2/Nginx/IIS logs and view dinamically generated statistics
|
Functions | |
const size_t | count (std::string_view str, const char flag) |
Count the occurrences of the given sequence in the given string. | |
const size_t | count (std::string_view str, std::string_view flag) |
Count the occurrences of the given sequence in the given string. | |
const bool | isNumeric (const char &chr) |
Checks whether character is numeric. | |
const bool | isNumeric (std::string_view str) |
Checks whether a string only contains numeric characters. | |
const bool | isAlphabetic (const char &chr) |
Checks whether a character is alphabetic. | |
const bool | isAlphabetic (std::string_view str) |
Checks whether a string only contains alphabetic characters. | |
const bool | isAlnum (const char &chr) |
Checks whether a character is alpha-numeric. | |
const bool | isAlnum (std::string_view str) |
Checks whether a string only contains alpha-numeric characters. | |
const bool | isHex (const char &chr) |
Checks whether a string only contains hexadecimal characters. | |
const bool | isIP (std::string_view str) |
Checks whether a string contains only IPv4/IPv6 chars. | |
const bool | startsWith (std::string_view str, const char flag) |
Checks if a string starts with the given sequence. | |
const bool | startsWith (std::string_view str, std::string_view flag) |
Checks if a string starts with the given sequence. | |
const bool | endsWith (std::string_view str, const char flag) |
Checks if a string ends with the given sequence. | |
const bool | endsWith (std::string_view str, std::string_view flag) |
Checks if a string ends with the given sequence. | |
const bool | contains (std::string_view str, std::string_view flag) |
Checks if a string contains the given sequence. | |
const std::string | strip (const std::string &str, const char chr) |
Strips the given character from both the left and the right side of a string. | |
const std::string | strip (const std::string &str, std::string_view chars=" \n\t\b\r\v") |
Strips the given characters from both the left and the right side of a string. | |
const std::string | lstrip (const std::string &str, const char chr) |
Strips the given character from the left side of a string. | |
const std::string | lstrip (const std::string &str, std::string_view chars=" \n\t\b\r\v") |
Strips the given characters from the left side of a string. | |
const std::string | rstrip (const std::string &str, const char chr) |
Strips the given character from the right side of a string. | |
const std::string | rstrip (const std::string &str, std::string_view chars=" \n\t\b\r\v") |
Strips the given characters from the right side of a string. | |
const std::string | lstripUntil (const std::string &str, const char delim, const bool inclusive=true, const bool consecutives=true) |
Strips everything from a string starting from the left side untill the delimiter is found (a.k.a. cut) | |
void | split (std::vector< std::string > &list, const std::string &target_str, const char separator='\n') |
Splits a string using a separator. | |
void | split (std::vector< std::string > &list, const std::string &target_str, std::string_view separator) |
Splits a string using a separator. | |
void | splitrip (std::vector< std::string > &list, const std::string &target_str, const char separator='\n', std::string_view strips=" \n\t\b\r\v") |
Splits a string and strips all the splitted items. | |
void | splitrip (std::vector< std::string > &list, const std::string &target_str, std::string_view separator, std::string_view strips=" \n\t\b\r\v") |
Splits a string and strips all the splitted items. | |
const std::string | replace (std::string_view str, std::string_view target, std::string_view replace) |
Replaces all the occurrences of a sequence with another. | |
const std::string | toUpper (std::string_view str) |
Converts a string to upper case. | |
const std::string | toLower (std::string_view str) |
Converts a string to lower case. | |
Utilities for the strings
const bool StringOps::contains | ( | std::string_view | str, |
std::string_view | flag | ||
) |
Checks if a string contains the given sequence.
str | The target string |
flag | The sequence to search for |
const size_t StringOps::count | ( | std::string_view | str, |
const char | flag | ||
) |
Count the occurrences of the given sequence in the given string.
str | The target string |
flag | The character to find |
const size_t StringOps::count | ( | std::string_view | str, |
std::string_view | flag | ||
) |
Count the occurrences of the given sequence in the given string.
str | The target string |
flag | The string to find |
const bool StringOps::endsWith | ( | std::string_view | str, |
const char | flag | ||
) |
Checks if a string ends with the given sequence.
str | The target string |
flag | The character to search for |
const bool StringOps::endsWith | ( | std::string_view | str, |
std::string_view | flag | ||
) |
Checks if a string ends with the given sequence.
Passing an empty flag ends in a false positive
str | The target string |
flag | The sequence to search for |
const bool StringOps::isAlnum | ( | const char & | chr | ) |
Checks whether a character is alpha-numeric.
str | The target character |
const bool StringOps::isAlnum | ( | std::string_view | str | ) |
Checks whether a string only contains alpha-numeric characters.
str | The target string |
const bool StringOps::isAlphabetic | ( | const char & | chr | ) |
Checks whether a character is alphabetic.
str | The target character |
const bool StringOps::isAlphabetic | ( | std::string_view | str | ) |
Checks whether a string only contains alphabetic characters.
str | The target string |
const bool StringOps::isHex | ( | const char & | chr | ) |
Checks whether a string only contains hexadecimal characters.
str | The target character |
const bool StringOps::isIP | ( | std::string_view | str | ) |
Checks whether a string contains only IPv4/IPv6 chars.
This method doesn't check if the IP could be actually valid, since this is beyond its purpose
str | The target string |
const bool StringOps::isNumeric | ( | const char & | chr | ) |
Checks whether character is numeric.
str | The target character |
const bool StringOps::isNumeric | ( | std::string_view | str | ) |
Checks whether a string only contains numeric characters.
str | The target string |
const std::string StringOps::lstrip | ( | const std::string & | str, |
const char | chr | ||
) |
Strips the given character from the left side of a string.
str | The target string |
chr | The character to strip away |
const std::string StringOps::lstrip | ( | const std::string & | str, |
std::string_view | chars = " \n\t\b\r\v" |
||
) |
Strips the given characters from the left side of a string.
str | The target string |
chars | The characters to strip away |
const std::string StringOps::lstripUntil | ( | const std::string & | str, |
const char | delim, | ||
const bool | inclusive = true , |
||
const bool | consecutives = true |
||
) |
Strips everything from a string starting from the left side untill the delimiter is found (a.k.a. cut)
str | The target string |
delim | The delimiter |
inclusive | Whether to also strip the delimiter or not |
consecutives | Whether to strip all the occurrences of the delimiter if they're consecutive, only applies if inclusive |
const std::string StringOps::replace | ( | std::string_view | str, |
std::string_view | target, | ||
std::string_view | replace | ||
) |
Replaces all the occurrences of a sequence with another.
str | The target string |
target | The sequence which will be replaced |
replace | The sequence to be used to replace the target |
const std::string StringOps::rstrip | ( | const std::string & | str, |
const char | chr | ||
) |
Strips the given character from the right side of a string.
str | The target string |
chr | The character to strip away |
const std::string StringOps::rstrip | ( | const std::string & | str, |
std::string_view | chars = " \n\t\b\r\v" |
||
) |
Strips the given characters from the right side of a string.
str | The target string |
chars | The characters to strip away |
void StringOps::split | ( | std::vector< std::string > & | list, |
const std::string & | target_str, | ||
const char | separator = '\n' |
||
) |
Splits a string using a separator.
list | Will hold the splitted content |
target_str | The target string |
separator | The character to use as separator |
void StringOps::split | ( | std::vector< std::string > & | list, |
const std::string & | target_str, | ||
std::string_view | separator | ||
) |
Splits a string using a separator.
list | Will hold the splitted content |
target_str | The target string |
separator | The sequence to use as separator |
void StringOps::splitrip | ( | std::vector< std::string > & | list, |
const std::string & | target_str, | ||
const char | separator = '\n' , |
||
std::string_view | strips = " \n\t\b\r\v" |
||
) |
Splits a string and strips all the splitted items.
list | Will hold the splitted content |
target_str | The target string |
separator | The sequence to use as separator |
strip | The characters to strip away |
void StringOps::splitrip | ( | std::vector< std::string > & | list, |
const std::string & | target_str, | ||
std::string_view | separator, | ||
std::string_view | strips = " \n\t\b\r\v" |
||
) |
Splits a string and strips all the splitted items.
list | Will hold the splitted content |
target_str | The target string |
separator | The sequence to use as separator |
strip | The characters to strip away |
const bool StringOps::startsWith | ( | std::string_view | str, |
const char | flag | ||
) |
Checks if a string starts with the given sequence.
str | The target string |
flag | The character to search for |
const bool StringOps::startsWith | ( | std::string_view | str, |
std::string_view | flag | ||
) |
Checks if a string starts with the given sequence.
Passing an empty flag ends in a false positive
str | The target string |
flag | The sequence to search for |
const std::string StringOps::strip | ( | const std::string & | str, |
const char | chr | ||
) |
Strips the given character from both the left and the right side of a string.
str | The target string |
chr | The character to strip away |
const std::string StringOps::strip | ( | const std::string & | str, |
std::string_view | chars = " \n\t\b\r\v" |
||
) |
Strips the given characters from both the left and the right side of a string.
str | The target string |
chars | The characters to strip away |
const std::string StringOps::toLower | ( | std::string_view | str | ) |
Converts a string to lower case.
str | The target string |
const std::string StringOps::toUpper | ( | std::string_view | str | ) |
Converts a string to upper case.
str | The target string |