asge::str
Enumerations
enum class TextAlignHow Justify pads a string to a target width — None pads nothing (see Justify's default case).
NoneLeftCenterRightTypedefs
using String = std::stringusing StringView = std::string_viewusing WString = std::wstringusing WStringView = std::wstring_viewusing U8String = std::u8stringFunctions
str::String ToString(TextAlign inAlign) noexceptTextAlign -> its lowercase TOML/display representation ("none" for anything unrecognized).
The read-side counterpart to ToString — any string other than "left"/"center"/"right" maps to None.
StringView Trim(StringView inSv) noexceptRemoves leading and trailing whitespace from a string_view.
This function scans the input string_view from both ends, stripping out standard whitespace characters (spaces, tabs, newlines, and carriage returns). Because it operates on and returns a std::string_view, it performs no dynamic memory allocations or string copying.
inSv | The input string_view to be trimmed. |
StringView Trim(StringView inSv, StringView inCharsToTrim) noexceptRemoves leading and trailing characters from a custom set.
Same zero-copy behaviour as the single-argument Trim, but strips only the characters listed in inCharsToTrim instead of standard whitespace.
Splits a string_view into a vector of sub-views based on a delimiter string.
Scans the input string_view and splits it wherever the sequence of characters specified by the delimiter inSep is found. Because it returns a vector of std::string_view, the individual tokens are zero-copy views into the original string.
inSv | The input string_view to be split. |
inSep | A null-terminated C-string representing the delimiter sequence. |
A std::vector<std::string> containing the split tokens in order.
UTF-8 encoder for \uXXXX and \UXXXXXXXX.
inCp | The unsigned 32-bit integer to encode into a string |
The encoded string
std::size_t CodePointLength(StringView inStr) noexceptCounts inStr's Unicode code points rather than its bytes.
Walks inStr one UTF-8 sequence at a time via each byte's leading-byte pattern; a byte that doesn't match a valid 1-4 byte UTF-8 lead is treated as its own 1-byte code point (malformed input still terminates instead of looping forever, at the cost of an inflated count for that byte).
int DecodeUtf8(StringView inText, std::size_t &ioPos) noexceptDecodes one UTF-8 code point at ioPos and advances ioPos past it.
Malformed bytes decode as U+FFFD.
Pads inStr with spaces to inWidth code points, per inAlignment.
Returns inStr unchanged (no truncation) if it's already at least inWidth code points long. TextAlign::Center splits an odd remainder with the extra space on the right; TextAlign::None pads nothing, same as an already-wide-enough string.