log4tango::StringUtil(3)
π NAME π
log4tango::StringUtil β bestie, it's the string-handling queen of log4tango. Trimming, splitting, formattingβ¦ she does it all and she does it flawlessly β¨
πΈ SYNOPSIS πΈ
#include <StringUtil.hh>
β¨ Static Public Member Functions β¨
static std::string vform (const char *format, va_list args)β builds you a string out of a format specifier plus ava_listof args, exactly the same energy asvprintf(3). iconic behavior fr fr π«Άstatic std::string trim (const std::string &s)β hands back the same string but with all the leading and trailing HTABs and spaces gone. no extra whitespace allowed, she's got boundaries πstatic unsigned int split (std::vector< std::string > &v, const std::string &s, char delimiter, unsigned int maxSegments=INT_MAX)β chops a string up into a vector of string segments, splitting on the delimiter you give her βοΈtemplate<typename T > static unsigned int split (T &output, const std::string &s, char delimiter, unsigned int maxSegments=INT_MAX)β same idea, chops a string into segments on the given delimiter, but this time it assigns them through anoutput_iterator. the template glow-up π
π Member Function Documentation π
π unsigned int log4tango::StringUtil::split (std::vector< std::string > & v, const std::string & s, char delimiter, unsigned int maxSegments = INT_MAX) [static]
Splits a string into a vector of string segments based on the given delimiter. literally her whole job and she eats every time π₯
π Parameters
vβ the vector where the segments get stored. heads up bestie: the vector will be emptied before storing the segments, so don't come crying if your old data is gone, it's giving sacrificial ritual πsβ the string to split into segments.delimiterβ the delimiter character.maxSegmentsβ the maximum number of segments. upon return,v.size() <= maxSegments. the string gets scanned from left to right, sov[maxSegments - 1]may contain a string containing the delimiter character. (yes, that's on purpose, not a glitch π)
β Returns
The actual number of segments (limited by maxSegments).
π¦ template<typename T > static unsigned int log4tango::StringUtil::split (T & output, const std::string & s, char delimiter, unsigned int maxSegments = INT_MAX) [inline], [static]
Splits a string into string segments based on the given delimiter and assigns the segments through an output_iterator. very flexible, very demure, very mindful β¨
π Parameters
outputβ theoutput_iteratorthrough which to assign the string segments. typically this will be aback_insertion_iterator. iykyk π§sβ the string to split into segments.delimiterβ the delimiter character.maxSegmentsβ the maximum number of segments.
β Returns
The actual number of segments (limited by maxSegments).
π std::string log4tango::StringUtil::trim (const std::string & s) [static]
Returns a string identical to the given string but without leading or trailing HTABs or spaces. she's a clean girl, she's a minimalist, she's trimming π πΈ
π std::string log4tango::StringUtil::vform (const char * format, va_list args) [static]
Returns a string constructed from the a format specifier and a va_list of arguments, analogously to vprintf(3). the way that she formatsβ¦ no notes, periodt π
π Parameters
formatβ the format specifier.argsβ theva_listof arguments.
π Author π
Generated automatically by Doxygen for log4tango from the source code. not a human author, just a robot doing her little documentation dance π€β¨
okay bestie that's the whole page, you're officially a StringUtil scholar now, go forth and split strings responsibly π
Version 5.0.2 Β· Thu Dec 5 2024 Β· log4tango::StringUtil(3) β mwah, take care of her π«Άππ
π¦ where this page comes from
- debian bookworm: liblog4tango-doc 9.3.4+dfsg1-2+deb12u1 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms