Links
Comment on page

string

Libray to interact with strings.

Types

std::string::SizedString

A ASCII string with a prefixed size.
  • <SizeType>: The type of the size field.
using SizedString<SizeType> = std::string::SizedStringBase;

std::string::SizedString16

A UTF-16 string with a prefixed size.
  • <SizeType>: The type of the size field.
using SizedString16<SizeType> = std::string::SizedStringBase;

std::string::SizedStringBase

Base type for sized strings. Represents a string with its size preceeding it.
  • <SizeType>: The type of the size field.
  • <DataType>: The type of the characters.
struct SizedStringBase<, > { ... } [[sealed, format, transform]];

Functions

std::string::length

Gets the length of a string.
  • string: The string to get the length of.
  • return: The length of the string.
fn length(str string);

std::string::at

Gets the character at a given index.
  • string: The string to get the character from.
  • index: The index of the character to get.
  • return: The character at the given index.
fn at(str string, u32 index);

std::string::substr

Gets a substring of a string.
  • string: The string to get the substring from.
  • pos: The position of the first character of the substring.
  • count: The number of characters to get.
  • return: The substring.
fn substr(str string, u32 pos, u32 count);

std::string::parse_int

Converts a string to an integer.
  • string: The string to convert.
  • base: The base of the number.
  • return: The integer.
fn parse_int(str string, u8 base);

std::string::parse_float

Converts a string to a float.
  • string: The string to convert.
  • return: The float.
fn parse_float(str string);

std::string::to_string

Converts any type to a string.
  • x: The value to convert.
  • return: The string.
fn to_string(auto x);

std::string::starts_with

Checks if a string starts with a given substring.
  • string: The string to check.
  • part: The substring to check for.
  • return: True if the string starts with the substring, false otherwise.
fn starts_with(str string, str part);

std::string::ends_with

Checks if a string ends with a given substring.
  • string: The string to check.
  • part: The substring to check for.
  • return: True if the string ends with the substring, false otherwise.
fn ends_with(str string, str part);

std::string::contains

Checks if a string contains a given substring.
  • string: The string to check.
  • part: The substring to check for.
  • return: True if the string contains the substring, false otherwise.
fn contains(str string, str part);

std::string::reverse

Reverses a string.
  • string: The string to reverse.
  • return: The reversed string.
fn reverse(str string);

std::string::to_upper

Converts a string to upper case.
  • string: The string to convert.
  • return: The converted string.
fn to_upper(str string);

std::string::to_lower

Converts a string to lower case.
  • string: The string to convert.
  • return: The converted string.
fn to_lower(str string);

std::string::replace

Replaces all occurrences of a substring with another substring.
  • string: The string to replace in.
  • pattern: The substring to replace.
  • replace: The substring to replace with.
  • return: The string with the replacements.
fn replace(str string, str pattern, str replace);
Last modified 6mo ago