|
jaulib v1.4.1
Jau Support Library (C++, Java, ..)
|
String utilities for type conversion and manipulation. More...
Namespaces | |
| namespace | jau::cfmt2::impl |
| namespace | jau::cfmt::impl |
| namespace | jau::unsafe |
Classes | |
| struct | jau::cfmt::PResult |
| struct | jau::cfmt2::PResult |
| struct | jau::string_hash |
| C++20: Heterogeneous Lookup in (Un)ordered Containers. More... | |
Typedefs | |
| template<typename T> | |
| using | jau::StringHashMap = std::unordered_map<std::string, T, string_hash, std::equal_to<>> |
| using | jau::StringHashSet = std::unordered_set<std::string, string_hash, std::equal_to<>> |
Functions | |
| std::string & | jau::appendToHexString (std::string &dest, const uint8_t value, const LoUpCase capitalization=LoUpCase::lower) noexcept |
| Produce a hexadecimal string representation of the given byte value and appends it to the given string. | |
| template<typename... Targs> | |
| constexpr bool | jau::cfmt2::check (const std::string_view fmt, const Targs &...) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename... Targs> | |
| constexpr bool | jau::cfmt::check (const std::string_view fmt, const Targs &...) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename... Targs> | |
| constexpr bool | jau::cfmt2::check2 (const std::string_view fmt) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename... Targs> | |
| constexpr bool | jau::cfmt::check2 (const std::string_view fmt) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename StrView, typename... Targs> | |
| constexpr bool | jau::cfmt::check3 (StrView fmt) noexcept |
| template<typename... Targs> | |
| constexpr const PResult | jau::cfmt2::checkR (const std::string_view fmt, const Targs &...) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename... Targs> | |
| constexpr PResult | jau::cfmt::checkR (const std::string_view fmt, const Targs &...) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename... Targs> | |
| constexpr const PResult | jau::cfmt2::checkR2 (const std::string_view fmt) noexcept |
| Strict type validation of arguments against the format string. | |
| template<typename... Targs> | |
| constexpr PResult | jau::cfmt::checkR2 (const std::string_view fmt) noexcept |
| Strict type validation of arguments against the format string. | |
| template<StringLiteral format, typename... Args> | |
| consteval_cxx20 std::string | jau::format_string (const Args &...args) |
Safely returns a (non-truncated) string according to snprintf() formatting rules using an initially string length of 1023 w/o EOS and variable number of arguments following the format argument. | |
| template<typename... Args> | |
| constexpr std::string | jau::format_string (const std::string_view format, const Args &...args) |
Safely returns a (non-truncated) string according to snprintf() formatting rules using an initially string length of 1023 w/o EOS and variable number of arguments following the format argument. | |
| template<StringLiteral format, typename... Args> | |
| consteval_cxx20 std::string | jau::format_string_h (const std::size_t strLenHint, const Args &...args) |
Safely returns a (non-truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument. | |
| template<typename... Args> | |
| constexpr std::string | jau::format_string_h (const std::size_t strLenHint, const std::string_view format, const Args &...args) |
Safely returns a (non-truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument. | |
| template<StringLiteral format, typename... Args> | |
| consteval_cxx20 std::string | jau::format_string_n (const std::size_t maxStrLen, const Args &...args) |
Safely returns a (potentially truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument. | |
| template<typename... Args> | |
| constexpr std::string | jau::format_string_n (const std::size_t maxStrLen, const std::string_view &format, const Args &...args) |
Safely returns a (potentially truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument. | |
| UInt64SizeBoolTuple | jau::fromBitString (std::string_view const bitstr, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True) noexcept |
| Converts a given binary string representation into a uint64_t value according to bitStringBytes(). | |
| SizeBoolPair | jau::fromBitString (std::vector< uint8_t > &out, const std::string_view bitstr, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True) noexcept |
| See fromBitString() | |
| SizeBoolPair | jau::fromBitString (std::vector< uint8_t > &out, const uint8_t bitstr[], const size_t bitstr_len, const bit_order_t bitOrder=bit_order_t::msb, const Bool checkPrefix=Bool::True) noexcept |
| Converts a given binary string representation into a byte vector, lsb-first. | |
| UInt64SizeBoolTuple | jau::fromHexString (std::string_view const hexstr, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True) noexcept |
| Converts a given hexadecimal string representation into a uint64_t value according to hexStringBytes(). | |
| SizeBoolPair | jau::fromHexString (std::vector< uint8_t > &out, const std::string_view hexstr, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True) noexcept |
| See hexStringBytes() | |
| SizeBoolPair | jau::fromHexString (std::vector< uint8_t > &out, const uint8_t hexstr[], const size_t hexstr_len, const lb_endian_t byteOrder=lb_endian_t::big, const Bool checkPrefix=Bool::True) noexcept |
| Converts a given hexadecimal string representation into a byte vector, lsb-first. | |
| std::string | jau::get_string (const uint8_t *buffer, nsize_t const buffer_len, nsize_t const max_len) noexcept |
| Returns a C++ String taken from buffer with maximum length of min(max_len, max_len). | |
| bool | jau::is_ascii_code (int c) noexcept |
| static constexpr bool | jau::cfmt2::isDigit (const char c) noexcept |
| static constexpr bool | jau::cfmt::isDigit (const char c) noexcept |
| std::ostream & | jau::cfmt2::operator<< (std::ostream &out, const PResult &pc) |
| std::ostream & | jau::cfmt::operator<< (std::ostream &out, const PResult &pc) |
| std::vector< std::string > | jau::split_string (const std::string &str, const std::string &separator) noexcept |
Split given string str at separator into the resulting std::vector excluding the separator sequence . | |
| template<class value_type, std::enable_if_t< std::is_integral_v< value_type >, bool > = true> | |
| std::string | jau::to_decstring (const value_type &v, const char separator=',', const nsize_t width=0) noexcept |
| Produce a decimal string representation of an integral integer value. | |
| Int64SizeBoolTuple | jau::to_integer (const char *str, size_t str_len, const nsize_t radix=10, const char limiter='\0', const char *limiter_pos=nullptr) |
Returns tuple [int64_t result, size_t consumed_chars, bool complete] of string to integer conversion via std::strtoll. | |
| Int64SizeBoolTuple | jau::to_integer (const std::string_view str, const nsize_t radix=10, const char limiter='\0', const char *limiter_pos=nullptr) |
Returns tuple [int64_t result, size_t consumed_chars, bool complete] of string to integer conversion via std::strtoll. | |
| static constexpr const char * | jau::cfmt2::to_string (plength_t s) noexcept |
| static constexpr const char * | jau::cfmt2::to_string (pstate_t s) noexcept |
| static constexpr const char * | jau::cfmt::to_string (plength_t s) noexcept |
| static constexpr const char * | jau::cfmt::to_string (pstate_t s) noexcept |
| template<class value_type, std::enable_if_t<(std::is_integral_v< value_type > &&!std::is_same_v< bool, value_type >)||std::is_floating_point_v< value_type >, bool > = true> | |
| std::string | jau::to_string (const value_type &ref) |
| template<typename T> | |
| std::string | jau::to_string (std::vector< T > const &list) |
| template<typename T> | |
| std::string | jau::to_string (std::vector< T > const &list, const nsize_t radix) |
| template<typename T> | |
| std::string | jau::to_string (std::vector< T > const &list, const std::string &delim) |
| template<typename T> | |
| std::string | jau::to_string (std::vector< T > const &list, const std::string &delim, const nsize_t radix) |
| template<class value_type, std::enable_if_t< std::is_integral_v< value_type > &&std::is_unsigned_v< value_type >, bool > = true> | |
| std::string | jau::to_string (value_type v, const nsize_t radix, const PrefixOpt prefix=PrefixOpt::prefix, size_t min_width=0, const char separator=0, const char padding='0') noexcept |
| Produce a string representation of an unsigned integral integer value with given radix. | |
| template<class uint8_container_type> requires jau::req::contiguous_container<uint8_container_type> && std::convertible_to<typename uint8_container_type::value_type, uint8_t> | |
| std::string | jau::toBitString (const uint8_container_type &bytes, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept |
Produce a binary string representation with leading 0b in MSB of the given uint8_t continuous container values. | |
| std::string | jau::toBitString (const void *data, const nsize_t length, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept |
| Produce a binary string representation of the given lsb-first byte values. | |
| template<class value_type> requires jau::req::standard_layout<value_type> && jau::req::trivially_copyable<value_type> && (!jau::req::container<value_type>) && (!jau::req::pointer<value_type>) | |
| std::string | jau::toBitString (value_type const &v, const bit_order_t bitOrder=bit_order_t::msb, const PrefixOpt prefix=PrefixOpt::prefix, size_t bit_len=0) noexcept |
Produce a binary string representation with leading 0b in MSB of the given value with standard layout. | |
| template<class uint8_container_type> requires jau::req::contiguous_container<uint8_container_type> && std::convertible_to<typename uint8_container_type::value_type, uint8_t> | |
| std::string | jau::toHexString (const uint8_container_type &bytes, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt skipPrefix=PrefixOpt::prefix) noexcept |
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given uint8_t continuous container values. | |
| std::string | jau::toHexString (const void *data, const nsize_t length, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept |
| Produce a hexadecimal string representation of the given lsb-first byte values. | |
| template<class value_type> requires jau::req::pointer<value_type> && (!jau::req::container<value_type>) | |
| std::string | jau::toHexString (value_type const &v, const lb_endian_t byteOrder=lb_endian_t::big, const LoUpCase capitalization=LoUpCase::lower, const PrefixOpt prefix=PrefixOpt::prefix) noexcept |
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given pointer. | |
| std::string | jau::toLower (const std::string &s) noexcept |
| std::string & | jau::toLowerInPlace (std::string &s) noexcept |
| std::string | jau::trim (const std::string &s) noexcept |
| trim copy | |
| void | jau::trimInPlace (std::string &s) noexcept |
| trim in place | |
Variables | |
| constexpr const char * | jau::HexadecimalArray = "0123456789abcdef" |
String utilities for type conversion and manipulation.
| using jau::StringHashMap = std::unordered_map<std::string, T, string_hash, std::equal_to<>> |
Definition at line 929 of file string_util.hpp.
| using jau::StringHashSet = std::unordered_set<std::string, string_hash, std::equal_to<>> |
Definition at line 931 of file string_util.hpp.
|
strong |
| Enumerator | |
|---|---|
| error | |
| outside | |
| start | |
| field_width | |
| precision | |
Definition at line 98 of file string_cfmt.hpp.
|
strong |
| Enumerator | |
|---|---|
| hh | |
| h | |
| none | |
| l | |
| ll | |
| j | |
| z | |
| t | |
| L | |
Definition at line 114 of file string_cfmt.hpp.
|
strong |
| Enumerator | |
|---|---|
| lower | |
| upper | |
Definition at line 95 of file string_util.hpp.
|
strong |
| Enumerator | |
|---|---|
| none | |
| prefix | |
Definition at line 100 of file string_util.hpp.
|
strong |
| Enumerator | |
|---|---|
| error | |
| outside | |
| start | |
| field_width | |
| precision | |
Definition at line 97 of file string_cfmt2.hpp.
|
strong |
| Enumerator | |
|---|---|
| hh | |
| h | |
| none | |
| l | |
| ll | |
| j | |
| z | |
| t | |
| L | |
Definition at line 113 of file string_cfmt2.hpp.
|
staticconstexprnoexcept |
|
staticconstexprnoexcept |
Definition at line 125 of file string_cfmt.hpp.
|
staticconstexprnoexcept |
Definition at line 140 of file string_cfmt.hpp.
|
inline |
Definition at line 241 of file string_cfmt.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
| args | passed arguments, used for template type deduction only |
Definition at line 733 of file string_cfmt.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
Definition at line 753 of file string_cfmt.hpp.
|
constexprnoexcept |
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
| args | passed arguments, used for template type deduction only |
Definition at line 786 of file string_cfmt.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
Definition at line 807 of file string_cfmt.hpp.
|
inlinenoexcept |
Definition at line 60 of file string_util.hpp.
|
noexcept |
Returns a C++ String taken from buffer with maximum length of min(max_len, max_len).
The maximum length only delimits the string length and does not contain the EOS null byte. An EOS null byte will will be added.
The source string within buffer is not required to contain an EOS null byte;
Definition at line 436 of file basic_types.cpp.
|
noexcept |
trim in place
Definition at line 442 of file basic_types.cpp.
|
noexcept |
trim copy
Definition at line 451 of file basic_types.cpp.
|
noexcept |
Split given string str at separator into the resulting std::vector excluding the separator sequence .
Definition at line 457 of file basic_types.cpp.
|
noexcept |
|
noexcept |
|
noexcept |
Converts a given hexadecimal string representation into a byte vector, lsb-first.
In case a non valid hexadecimal digit appears in the given string, conversion ends and fills the byte vector up until the violation.
In case hexstr contains an odd number of hex-nibbles, it will be interpreted as follows
Even if complete==false, result holds the partial value if consumed_chars>0.
You may use C++17 structured bindings to handle the pair.
| out | the byte vector sink, lsb-first |
| hexstr | the hexadecimal string representation |
| hexstr_len | length of hextstr |
| byteOrder | lb_endian_t::big for big-endian bytes in hexstr (default) |
| checkPrefix | if True, checks for a leading 0x and removes it, otherwise not. |
Definition at line 565 of file basic_types.cpp.
|
inlinenoexcept |
See hexStringBytes()
Definition at line 130 of file string_util.hpp.
|
noexcept |
Converts a given hexadecimal string representation into a uint64_t value according to hexStringBytes().
Even if complete==false, result holds the partial value if consumed_chars>0.
You may use C++17 structured bindings to handle the tuple.
| hexstr | the hexadecimal string representation |
| byteOrder | lb_endian_t::big for big-endian bytes in hexstr (default) |
| checkPrefix | if True, checks for a leading 0x and removes it, otherwise not. |
Definition at line 642 of file basic_types.cpp.
|
noexcept |
Produce a hexadecimal string representation of the given lsb-first byte values.
If byteOrder is lb_endian_t::little, orders lsb-byte left, usual for byte streams. Result will not have a leading 0x. Otherwise, lb_endian_t::big (default), orders msb-byte left for integer values. Result will have a leading 0x if !skipPrefix.
| data | pointer to the first byte to print, lsb-first |
| length | number of bytes to print |
| byteOrder | lb_endian_t::big for big-endian bytes in resulting hex-string (default). A leading 0x will be prepended if byteOrder == lb_endian_t::big and PrefixOpt::prefix given. |
| capitalization | LoUpCase capitalization, default is LoUpCase::lower |
| prefix | pass PrefixOpt::prefix (default) to add leading 0x if byteOrder == lb_endian_t::big (default) |
Definition at line 764 of file basic_types.cpp.
|
noexcept |
Produce a hexadecimal string representation of the given byte value and appends it to the given string.
| dest | the std::string reference destination to append |
| value | the byte value to represent |
| capitalization | LoUpCase capitalization, default is LoUpCase::lower |
Definition at line 809 of file basic_types.cpp.
|
inlinenoexcept |
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given pointer.
| value_type | a pointer type |
| v | the pointer of given pointer type |
| byteOrder | lb_endian_t::big for big-endian bytes in resulting hex-string (default). A leading 0x will be prepended if byteOrder == lb_endian_t::big and PrefixOpt::prefix given. |
| capitalization | LoUpCase capitalization, default is LoUpCase::lower |
| prefix | pass PrefixOpt::prefix (default) to add leading 0x if byteOrder == lb_endian_t::big (default) |
Definition at line 196 of file string_util.hpp.
|
inlinenoexcept |
Produce a lower-case hexadecimal string representation with leading 0x in MSB of the given uint8_t continuous container values.
| uint8_container_type | a uint8_t continuous container type |
| bytes | the value of given uint8_t continuous container type |
| byteOrder | lb_endian_t::big for big-endian bytes in resulting hex-string (default). A leading 0x will be prepended if byteOrder == lb_endian_t::big and PrefixOpt::prefix given. |
| capitalization | LoUpCase capitalization, default is LoUpCase::lower |
| prefix | pass PrefixOpt::prefix (default) to add leading 0x if byteOrder == lb_endian_t::big (default) |
Definition at line 227 of file string_util.hpp.
|
noexcept |
Converts a given binary string representation into a byte vector, lsb-first.
In case a non valid binary digit appears in the given string, conversion ends and fills the byte vector up until the violation.
In case bitstr contains an incomplete number of bit-nibbles, it will be interpreted as follows
Even if complete==false, result holds the partial value if consumed_chars>0.
You may use C++17 structured bindings to handle the pair.
| out | the byte vector sink, lsb-first |
| bitstr | the binary string representation |
| bitstr_len | length of bitstr |
| bitOrder | bit_order_t::msb for most significant bits in bitstr first (default) |
| checkPrefix | if True, checks for a leading 0b and removes it, otherwise not. |
Definition at line 666 of file basic_types.cpp.
|
inlinenoexcept |
See fromBitString()
Definition at line 296 of file string_util.hpp.
|
noexcept |
Converts a given binary string representation into a uint64_t value according to bitStringBytes().
Even if complete==false, result holds the partial value if consumed_chars>0.
You may use C++17 structured bindings to handle the tuple.
| bitstr | the binary string representation |
| checkPrefix | if true, checks for a leading 0b and removes it, otherwise not. |
| bitOrder | bit_order_t::msb for most significant bits in bitstr first (default) |
Definition at line 745 of file basic_types.cpp.
|
noexcept |
Produce a binary string representation of the given lsb-first byte values.
If byteOrder is lb_endian_t::little, orders lsb-byte left, usual for byte streams. Result will not have a leading 0b. Otherwise, lb_endian_t::big (default), orders msb-byte left for integer values. Result will have a leading 0b if !skipPrefix.
| data | pointer to the first byte to print, lsb-first |
| length | number of bytes to print |
| bitOrder | bit_order_t::msb for most-significant-bit first in resulting bit-string, bit_order_t::msb is default A leading 0b will be prepended if bitOrder == bit_order_t::msb and PrefixOpt::prefix given. |
| prefix | pass PrefixOpt::prefix (default) to add leading 0b if bitOrder == bit_order_t::msb (default) |
| bit_len | optional fixed number of bits to be printed counting from lsb excluding prefix. Pass zero for dropping zero leading bytes (default). |
Definition at line 821 of file basic_types.cpp.
|
inlinenoexcept |
Produce a binary string representation with leading 0b in MSB of the given uint8_t continuous container values.
| uint8_container_type | a uint8_t continuous container type |
| bytes | the value of given uint8_t continuous container type |
| bitOrder | bit_order_t::msb for most-significant-bit first in resulting bit-string, bit_order_t::msb is default A leading 0b will be prepended if bitOrder == bit_order_t::msb and PrefixOpt::prefix given. |
| prefix | pass PrefixOpt::prefix (default) to add leading 0b if bitOrder == bit_order_t::msb (default) |
| bit_len | optional fixed number of bits to be printed counting from lsb excluding prefix. Pass zero for dropping zero leading bytes (default). |
Definition at line 350 of file string_util.hpp.
|
inlinenoexcept |
Produce a binary string representation with leading 0b in MSB of the given value with standard layout.
| value_type | a standard layout value type |
| v | the value of given standard layout type |
| bitOrder | bit_order_t::msb for most-significant-bit first in resulting bit-string, bit_order_t::msb is default A leading 0b will be prepended if bitOrder == bit_order_t::msb and PrefixOpt::prefix given. |
| prefix | pass PrefixOpt::prefix (default) to add leading 0b if bitOrder == bit_order_t::msb (default) |
| bit_len | optional fixed number of bits to be printed counting from lsb excluding prefix. Pass zero for dropping zero leading bytes (default). |
Definition at line 372 of file string_util.hpp.
|
noexcept |
Produce a decimal string representation of an integral integer value.
| value_type | an integral integer type |
| v | the integral integer value |
| separator | if not 0, use as separation character, otherwise no separation characters are being used |
| width | the minimum number of characters to be printed. Add padding with blank space if result is shorter. |
Definition at line 402 of file string_util.hpp.
|
noexcept |
Produce a string representation of an unsigned integral integer value with given radix.
| value_type | an unsigned integral integer type |
| v | the unsigned integral integer value |
| radix | base of the number system, supported: 2 binary, 8 octal, 10 decimal, 16 hexadecimal |
| prefix | pass PrefixOpt::prefix (default) to add leading prefix for radix. Prefixes: 0x hex, 0 octal and 0b binary. |
| min_width | the minimum number of characters to be printed including prefix. Add padding with padding if result is shorter. |
| separator | separator character for each decimal 3 or other radix 4. Defaults to 0 for no separator. |
| padding | padding character, defaults to '0'. See 'min_width' above. |
Definition at line 450 of file string_util.hpp.
|
constexpr |
Safely returns a (potentially truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument.
jau::cfmt2::checkR2() is utilize to validate format against given arguments at runtime and throws jau::IllegalArgumentError on mismatch.
Resulting string is truncated to min(maxStrLen, formatLen), with formatLen being the given formatted string length of output w/o limitation.
| maxStrLen | maximum resulting string length |
| format | printf() compliant format string |
| args | optional arguments matching the format string |
Definition at line 641 of file string_util.hpp.
| consteval_cxx20 std::string jau::format_string_n | ( | const std::size_t | maxStrLen, |
| const Args &... | args ) |
Safely returns a (potentially truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument.
jau::cfmt2::checkR2() is utilize to validate format against given arguments at compile time and fails to compile on mismatch.
Resulting string is truncated to min(maxStrLen, formatLen), with formatLen being the given formatted string length of output w/o limitation.
| format | printf() compliant format string |
| maxStrLen | maximum resulting string length |
| args | optional arguments matching the format string |
Definition at line 664 of file string_util.hpp.
|
constexpr |
Safely returns a (non-truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument.
jau::cfmt2::checkR2() is utilize to validate format against given arguments at runtime and throws jau::IllegalArgumentError on mismatch.
Resulting string size matches formated output w/o limitation.
| strLenHint | initially used string length w/o EOS |
| format | printf() compliant format string |
| args | optional arguments matching the format string |
Definition at line 683 of file string_util.hpp.
| consteval_cxx20 std::string jau::format_string_h | ( | const std::size_t | strLenHint, |
| const Args &... | args ) |
Safely returns a (non-truncated) string according to snprintf() formatting rules and variable number of arguments following the format argument.
jau::cfmt2::checkR2() is utilize to validate format against given arguments at compile time and fails to compile on mismatch.
Resulting string size matches formated output w/o limitation.
| format | printf() compliant format string |
| strLenHint | initially used string length w/o EOS |
| args | optional arguments matching the format string |
Definition at line 705 of file string_util.hpp.
|
constexpr |
Safely returns a (non-truncated) string according to snprintf() formatting rules using an initially string length of 1023 w/o EOS and variable number of arguments following the format argument.
jau::cfmt2::checkR2() is utilize to validate format against given arguments at runtime and throws jau::IllegalArgumentError on mismatch.
Resulting string size matches formated output w/o limitation.
| format | printf() compliant format string |
| args | optional arguments matching the format string |
Definition at line 724 of file string_util.hpp.
| consteval_cxx20 std::string jau::format_string | ( | const Args &... | args | ) |
Safely returns a (non-truncated) string according to snprintf() formatting rules using an initially string length of 1023 w/o EOS and variable number of arguments following the format argument.
jau::cfmt2::checkR2() is utilize to validate format against given arguments at compile time and fails to compile on mismatch.
Resulting string size matches formated output w/o limitation.
| format | printf() compliant format string |
| args | optional arguments matching the format string |
Definition at line 742 of file string_util.hpp.
|
inline |
Definition at line 756 of file string_util.hpp.
| std::string jau::to_string | ( | std::vector< T > const & | list, |
| const std::string & | delim ) |
Definition at line 852 of file string_util.hpp.
| std::string jau::to_string | ( | std::vector< T > const & | list | ) |
Definition at line 868 of file string_util.hpp.
| std::string jau::to_string | ( | std::vector< T > const & | list, |
| const std::string & | delim, | ||
| const nsize_t | radix ) |
Definition at line 871 of file string_util.hpp.
| std::string jau::to_string | ( | std::vector< T > const & | list, |
| const nsize_t | radix ) |
Definition at line 887 of file string_util.hpp.
| Int64SizeBoolTuple jau::to_integer | ( | const char * | str, |
| size_t | str_len, | ||
| const nsize_t | radix = 10, | ||
| const char | limiter = '\0', | ||
| const char * | limiter_pos = nullptr ) |
Returns tuple [int64_t result, size_t consumed_chars, bool complete] of string to integer conversion via std::strtoll.
Even if complete==false, result holds the partial value if consumed_chars>0.
You may use C++17 structured bindings to handle the tuple.
Definition at line 910 of file basic_types.cpp.
|
inline |
Returns tuple [int64_t result, size_t consumed_chars, bool complete] of string to integer conversion via std::strtoll.
Even if complete==false, result holds the partial value if consumed_chars>0.
You may use C++17 structured bindings to handle the tuple.
Definition at line 906 of file string_util.hpp.
|
staticconstexprnoexcept |
|
staticconstexprnoexcept |
Definition at line 124 of file string_cfmt2.hpp.
|
staticconstexprnoexcept |
Definition at line 139 of file string_cfmt2.hpp.
|
inline |
Definition at line 256 of file string_cfmt2.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
| args | passed arguments, used for template type deduction only |
Definition at line 740 of file string_cfmt2.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
Definition at line 755 of file string_cfmt2.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
| args | passed arguments, used for template type deduction only |
Definition at line 771 of file string_cfmt2.hpp.
|
constexprnoexcept |
Strict type validation of arguments against the format string.
See jau_cfmt_header for details
| Targs | the argument template type pack to be validated against the format string |
| fmt | the snprintf format string |
Definition at line 786 of file string_cfmt2.hpp.
|
inlineconstexpr |
Definition at line 152 of file string_util.hpp.