cesium-native 0.52.0
Loading...
Searching...
No Matches
CesiumUtility::StringHelpers Class Reference

Helper functions for working with strings. More...

#include <CesiumUtility/StringHelpers.h>

Classes

struct  SplitOptions
 Options that control the behavior of splitOnCharacter. More...
 

Static Public Member Functions

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.
 

Detailed Description

Helper functions for working with strings.

Definition at line 12 of file StringHelpers.h.

Member Function Documentation

◆ 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
sThe string view to split.
separatorThe character to split on.
optionsOptions 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
sThe std::u8string.
Returns
The equivalent std::string.

The documentation for this class was generated from the following file: