Object of utx::Delim is used for inserting a delim value between two values.
class Delim final;
#include <utxcpp/core.hpp>
Delim() = delete; Delim(const std::string & a_delim_string) noexcept; template <utx::kspt::printable PrintableValue> Delim(const PrintableValue & delim) noexcept; Delim(const Delim & delim) noexcept;
inline bool operator==(const Delim & delim) const; template <utx::kspt::printable PrintableValue> inline bool operator==(const PrintableValue & value) const; template <utx::kspt::ostreamable OutStream> friend OutStream & operator<<(OutStream & os, const Delim & delim); inline bool isNoDelim() const; std::string data() const;
A constant value which indicates that there should not add a delim between values.
inline const std::string && NoDelim = "utx::NoDelim";
Empty string "", '' are not accepted by utx::Delim, which will throw an exception.
Please use utx::NoDelim, if you want to insert an empty delim.
![]() |
Note |
---|---|
|
#include <utxcpp/core.hpp> int main() { utx::print_with(utx::Delim{'-'}, "I", "have", 3, "apples"); utx::print(); utx::print_with('-', "I", "have", 3, "apples"); utx::print(); /* Result: I-have-3-apples I-have-3-apples */ utx::print_with(777, "It", "is", "too", "small."); utx::print(); /* Result: It777is777too777small. */ utx::print_with('-', 'I', "have", "no", "idea.", '\n'); /* Result: I-have-no-idea.- (Because there is a delim between "idea." and '\n') */ }
Last revised: June 13, 2022 at 03:08:21 GMT |