#include <StringUtilities.h>
Public Member Functions | |
Strings | lines (const std::string &input, const char *separator="\n") |
Returns a vector of strings splitting the input at the specified separator. | |
std::string | unlines (const Strings &input, const char *filler, int newlineat=1) |
Returns a string with the input strings concatenated. | |
Strings | unlines (const Strings &input) |
Convert all ' ' into in the input to new lines. | |
size_t | maxlength (const Strings &content) |
Find the longest line in the input and return it's lenght. | |
std::string | box (const Strings &content, const std::string &header=Global::Get()->EmptyString) |
Draw an ASCII art box around the content using the specified header. | |
Strings | createTable (const std::vector< Strings > &content, const Strings &header) |
Creates a ASCII table out of the content using the specified header. | |
std::string | fromInt (value_type value) |
Returns a string representation of an integer. | |
std::string | toupper (const std::string &convertToUpper) |
Converts a string to upper case. | |
std::string | tolower (const std::string &convertToLower) |
Converts a string to lower case. | |
std::vector< int > | calculateMinimumFieldSizes (const std::vector< Strings > &content, int fieldcount) |
Calculates the minimum size of each field in the content using the specified fieldcount. | |
void | rebaseMinimumFieldSizes (std::vector< int > &sizes, const Strings &header) |
Adjusts the minimum field sizes to take in account the size of the header. | |
void | capFieldSize (std::vector< int > &sizes, const int maxlinesize) |
Cap the field sizes so that their sum is equal to or less than the specified maximum. | |
void | capUnfairFields (std::vector< int > &sizes, int unfairFields, int maxFairSize, int slack) |
Cap the fields that are unproporitonally large using the specified attributes. | |
std::string | packFields (const Strings &fields, const std::vector< int > &fieldsizes) |
Pack the specified fields into one string using the specified fieldsizes. | |
Friends | |
class | Singleton< String > |
Definition at line 35 of file StringUtilities.h.
Strings String::lines | ( | const std::string & | input, | |
const char * | separator = "\n" | |||
) |
Returns a vector of strings splitting the input at the specified separator.
input | The input to search for the separator in. | |
separator | The separator to serach for. |
std::string String::unlines | ( | const Strings & | input, | |
const char * | filler, | |||
int | newlineat = 1 | |||
) |
Returns a string with the input strings concatenated.
input | The input to put together. | |
filler | The character to put between characters parts of the input. | |
newlineat | After how many lines of the input a newline will be added, when 0 no extra newlines will be added. |
Convert all '
' into in the input to new lines.
input | The input to search for lines containing ' '. |
size_t String::maxlength | ( | const Strings & | content | ) |
Find the longest line in the input and return it's lenght.
std::string String::box | ( | const Strings & | content, | |
const std::string & | header = Global::Get()->EmptyString | |||
) |
Draw an ASCII art box around the content using the specified header.
content | The lines that should be contained inside the box. | |
header | The header that will be put above the result (centered), will be left out if none is specified. |
Creates a ASCII table out of the content using the specified header.
content | The 'body' of the table, is asserted to be of same 'length' as the header. | |
header | The header to use for the table. |
std::string String::fromInt | ( | value_type | value | ) |
Returns a string representation of an integer.
std::string String::toupper | ( | const std::string & | convertToUpper | ) |
Converts a string to upper case.
std::string String::tolower | ( | const std::string & | convertToLower | ) |
Converts a string to lower case.
std::vector<int> String::calculateMinimumFieldSizes | ( | const std::vector< Strings > & | content, | |
int | fieldcount | |||
) |
Calculates the minimum size of each field in the content using the specified fieldcount.
void String::rebaseMinimumFieldSizes | ( | std::vector< int > & | sizes, | |
const Strings & | header | |||
) |
Adjusts the minimum field sizes to take in account the size of the header.
void String::capFieldSize | ( | std::vector< int > & | sizes, | |
const int | maxlinesize | |||
) |
Cap the field sizes so that their sum is equal to or less than the specified maximum.
void String::capUnfairFields | ( | std::vector< int > & | sizes, | |
int | unfairFields, | |||
int | maxFairSize, | |||
int | slack | |||
) |
Cap the fields that are unproporitonally large using the specified attributes.
std::string String::packFields | ( | const Strings & | fields, | |
const std::vector< int > & | fieldsizes | |||
) |
Pack the specified fields into one string using the specified fieldsizes.