log4tango::StringUtil(3)

πŸ“¦
version 9.3.4 Β· 2 versions
, in debian bookworm

πŸ’– 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 a va_list of args, exactly the same energy as vprintf(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 an output_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, so v[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 β€” the output_iterator through which to assign the string segments. typically this will be a back_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 β€” the va_list of 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