slang/util/String.h file

Various string utilities.

Namespaces

namespace slang
Root namespace.

Functions

std::string_view toStringView(std::span<char> text)
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.
std::optional<int32_t> strToInt(std::string_view str, size_t* pos = nullptr, int base = 10)
Parses the provided str in the specified base into a signed integer.
std::optional<uint32_t> strToUInt(std::string_view str, size_t* pos = nullptr, int base = 10)
Parses the provided str in the specified base into an unsigned integer.
std::optional<double> strToDouble(std::string_view str, size_t* pos = nullptr)
Parses the provided str into a floating point value.
void strToUpper(std::string& str)
Converts the provided string to all uppercase characters (assuming ASCII contents).
void strToLower(std::string& str)
Converts the provided string to all lowercase characters (assuming ASCII contents).
std::vector<std::string_view> splitString(std::string_view str, char delimiter)
Splits the provided string into substrings based on the provided delimiter.
char charToUpper(char c)
Converts a character to uppercase (assuming ASCII).
char charToLower(char c)
Converts a character to lowercase (assuming ASCII).
int editDistance(std::string_view left, std::string_view right, bool allowReplacements = true, int maxDistance = 0)
Determines the number of edits to the left string that are required to change it into the right string.
const std::string& getU8Str(const std::filesystem::path& path)
Gets a string representation of the given path, in UTF-8 encoding.