Helper functions for working with strings.
More...
#include <CesiumUtility/StringHelpers.h>
|
static std::string | toStringUtf8 (const std::u8string &s) |
| Converts a u8string to a string without changing its encoding. The output string is encoded in UTF-8, just like the input.
|
|
static std::string_view | trimWhitespace (const std::string_view &s) |
| Trims whitespace (spaces and tabs) from the start and end of a string view.
|
|
static std::vector< std::string_view > | splitOnCharacter (const std::string_view &s, char separator, const SplitOptions &options=SplitOptions{.trimWhitespace=true,.omitEmptyParts=true}) |
| Splits a string view on a specified character.
|
|
Helper functions for working with strings.
Definition at line 12 of file StringHelpers.h.
◆ splitOnCharacter()
static std::vector< std::string_view > CesiumUtility::StringHelpers::splitOnCharacter |
( |
const std::string_view & | s, |
|
|
char | separator, |
|
|
const SplitOptions & | options = SplitOptions{.trimWhitespace=true,.omitEmptyParts=true} ) |
|
static |
Splits a string view on a specified character.
- Parameters
-
s | The string view to split. |
separator | The character to split on. |
options | Options that control the behavior of the split. |
- Returns
- A vector of string views representing the parts of the split string.
◆ toStringUtf8()
static std::string CesiumUtility::StringHelpers::toStringUtf8 |
( |
const std::u8string & | s | ) |
|
|
static |
Converts a u8string
to a string
without changing its encoding. The output string is encoded in UTF-8, just like the input.
- Parameters
-
- Returns
- The equivalent
std::string
.
The documentation for this class was generated from the following file:
- /home/runner/work/cesium-native/cesium-native/CesiumUtility/include/CesiumUtility/StringHelpers.h