slang/util/String.h file

Various string utilities.

Namespaces

namespace slang
Root namespace.

Functions

auto toStringView(std::span<char> text) -> std::string_view
Converts a span of characters into a std::string_view.
void uintToStr(SmallVectorBase<char>& buffer, uint32_t value)
Converts the provided value into a string, storing it into buffer.
void uintToStr(SmallVectorBase<char>& buffer, uint64_t value)
Converts the provided value into a string, storing it into buffer.
auto strToInt(std::string_view str, size_t* pos = nullptr, int base = 10) -> std::optional<int32_t>
auto strToUInt(std::string_view str, size_t* pos = nullptr, int base = 10) -> std::optional<uint32_t>
auto strToDouble(std::string_view str, size_t* pos = nullptr) -> std::optional<double>
void strToUpper(std::string& str)
void strToLower(std::string& str)
auto editDistance(std::string_view left, std::string_view right, bool allowReplacements = true, int maxDistance = 0) -> int
auto getU8Str(const std::filesystem::path& path) -> std::string
auto widen(std::string_view str) -> std::string_view
Widens the provided UTF8 string into UTF16 wchars.
auto narrow(std::string_view str) -> std::string_view
Widens the provided UTF16 string into UTF8.