Search Results for

    Show / Hide Table of Contents

    Class String

    Represents text as a sequence of UTF-16 characters. Container uses a single dynamic memory allocation to store the characters data. Characters sequence is always null-terminated.

    Inheritance
    StringBase
    String
    Inherited Members
    StringBase::_data
    StringBase::_length
    String
    StringBase::Clear()
    StringBase::Compare(const StringBase& str, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::Contains(const T* subStr, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::Contains(const StringBase& subStr, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::EndsWith(T c, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::EndsWith(const StringBase& suffix, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::Find(T c)
    StringBase::Find(const T* subStr, StringSearchCase searchCase=StringSearchCase::CaseSensitive, int32 startPosition=-1)
    StringBase::Find(const StringBase& subStr, StringSearchCase searchCase=StringSearchCase::CaseSensitive, int32 startPosition=-1)
    StringBase::FindFirstOf(T c, int32 startPos = 0)
    StringBase::FindFirstOf(const T* str, int32 startPos = 0)
    StringBase::FindLast(T c)
    StringBase::FindLast(const T* subStr, StringSearchCase searchCase=StringSearchCase::CaseSensitive, int32 startPosition=-1)
    StringBase::FindLast(const StringBase& subStr, StringSearchCase searchCase=StringSearchCase::CaseSensitive, int32 startPosition=-1)
    StringBase::Get()
    StringBase::GetText()
    StringBase::HasChars()
    StringBase::IsEmpty()
    StringBase::Length()
    StringBase::operator*()
    String
    StringBase::operator[](int32 index)
    StringBase::Replace(T searchChar, T replacementChar, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::Replace(const T* searchText, const T* replacementText, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::Replace(const T* searchText, int32 searchTextLength, const T* replacementText, int32 replacementTextLength, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::ReserveSpace(int32 length)
    StringBase::Resize(int32 length)
    StringBase::Reverse()
    StringBase::StartsWith(T c, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::StartsWith(const StringBase& prefix, StringSearchCase searchCase=StringSearchCase::CaseSensitive)
    StringBase::~StringBase()
    Assembly: FlaxEngine.dll
    File: Engine/Core/Types/String.h
    Syntax
    public class String : public StringBase

    Constructors

    String()

    Initializes a new instance of the String class.

    Declaration
    public String() = default

    String(const char* str)

    Initializes a new instance of the String class.

    Declaration
    public String(const char* str)
    Parameters
    char str

    ANSI string

    String(const Char* str)

    Initializes a new instance of the String class.

    Declaration
    public String(const Char* str)
    Parameters
    Char str

    The UTF-16 string.

    String(const char* str, int32 length)

    Initializes a new instance of the String class.

    Declaration
    public String(const char* str, int32 length)
    Parameters
    char str

    The ANSI string.

    int32 length

    The ANSI string length.

    String(const Char* str, int32 length)

    Initializes a new instance of the String class.

    Declaration
    public String(const Char* str, int32 length)
    Parameters
    Char str

    The UTF-16 string.

    int32 length

    The UTF-16 string length.

    String(const String& str)

    Initializes a new instance of the String class.

    Declaration
    public String(const String& str)
    Parameters
    String str

    The reference to the string.

    String(const StringAnsi& str)

    Initializes a new instance of the String class.

    Declaration
    public String(const StringAnsi& str)
    Parameters
    StringAnsi str

    The reference to the string.

    String(const StringAnsiView& str)

    Initializes a new instance of the String class.

    Declaration
    public String(const StringAnsiView& str)
    Parameters
    StringAnsiView str

    The other string.

    String(const StringView& str)

    Initializes a new instance of the String class.

    Declaration
    public String(const StringView& str)
    Parameters
    StringView str

    The other string.

    String(String&& str)

    Initializes a new instance of the String class.

    Declaration
    public String(String&& str) noexcept
    Parameters
    String str

    The double reference to the string.

    Fields

    Empty

    Instance of the empty string.

    Declaration
    public static String Empty
    Field Value
    String

    Methods

    Append(const Char c)

    Appends the specified character to this string.

    Declaration
    public String Append(const Char c)
    Parameters
    Char c

    The character to append.

    Returns
    String

    The reference to this string.

    Append(const Char* chars, int32 count)

    Appends an array of characters to the string.

    Declaration
    public void Append(const Char* chars, int32 count)
    Parameters
    Char chars

    The array of characters to append. It does not need be null-terminated, and null characters are not treated specially.

    int32 count

    The number of characters to append.

    Append(const char* chars, int32 count)

    Appends an array of characters to the string.

    Declaration
    public void Append(const char* chars, int32 count)
    Parameters
    char chars

    The array of characters to append. It does not need be null-terminated, and null characters are not treated specially.

    int32 count

    The number of characters to append.

    Append(const String& text)

    Appends the specified text to this string.

    Declaration
    public String Append(const String& text)
    Parameters
    String text

    The text to append.

    Returns
    String

    The reference to this string.

    EndsWith(const StringView& suffix, StringSearchCase searchCase=StringSearchCase::CaseSensitive)

    Declaration
    public bool EndsWith(const StringView& suffix, StringSearchCase searchCase=StringSearchCase::CaseSensitive) const
    Parameters
    StringView suffix

    StringSearchCase searchCase

    Returns
    bool

    Format(const Char* format, const Args& ... args)

    Formats the message and gets it as a string.

    Declaration
    public static String Format(const Char* format, const Args& ... args)
    Parameters
    Char format

    The format string.

    Args... args

    The custom arguments.

    Returns
    String

    The formatted text.

    Type Parameters
    Args

    GetFirstLine()

    Gets the first line of the text (searches for the line terminator char).

    Declaration
    public String GetFirstLine() const
    Returns
    String

    The single line of text.

    Insert(int32 startIndex, const String& other)

    Inserts string into current string instance at given location.

    Declaration
    public void Insert(int32 startIndex, const String& other)
    Parameters
    int32 startIndex

    The index of the first character to insert.

    String other

    The string to insert.

    IsANSI()

    Checks if string contains only ANSI characters.

    Declaration
    public bool IsANSI() const
    Returns
    bool

    True if contains only ANSI characters, otherwise false.

    Left(int32 count)

    Gets the left most given number of characters.

    Declaration
    public String Left(int32 count) const
    Parameters
    int32 count

    The characters count.

    Returns
    String

    The substring.

    operator!=(const Char* other)

    Declaration
    public bool operator!=(const Char* other) const
    Parameters
    Char other

    Returns
    bool

    operator!=(const String& other)

    Declaration
    public bool operator!=(const String& other) const
    Parameters
    String other

    Returns
    bool

    operator/(const Char c)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/(const Char c) const
    Parameters
    Char c

    The character to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/(const Char* str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/(const Char* str) const
    Parameters
    Char str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/(const char* str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/(const char* str) const
    Parameters
    char str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/(const String& str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/(const String& str) const
    Parameters
    String str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/(const StringView& str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/(const StringView& str) const
    Parameters
    StringView str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/=(Char c)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/=(Char c)
    Parameters
    Char c

    The character to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/=(const Char* str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/=(const Char* str)
    Parameters
    Char str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/=(const char* str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/=(const char* str)
    Parameters
    char str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/=(const String& str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/=(const String& str)
    Parameters
    String str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator/=(const StringView& str)

    Concatenates this path with given path ensuring the '/' character is used between them.

    Declaration
    public String operator/=(const StringView& str)
    Parameters
    StringView str

    The string to be concatenated onto the end of this.

    Returns
    String

    The combined path.

    operator+=(const Char c)

    Appends the specified character to this string.

    Declaration
    public String operator+=(const Char c)
    Parameters
    Char c

    The character to append.

    Returns
    String

    The reference to this string.

    operator+=(const Char* str)

    Appends the specified text to this string.

    Declaration
    public String operator+=(const Char* str)
    Parameters
    Char str

    The text to append.

    Returns
    String

    The reference to this string.

    operator+=(const char* str)

    Appends the specified text to this string.

    Declaration
    public String operator+=(const char* str)
    Parameters
    char str

    The text to append.

    Returns
    String

    The reference to this string.

    operator+=(const String& str)

    Appends the specified text to this string.

    Declaration
    public String operator+=(const String& str)
    Parameters
    String str

    The text to append.

    Returns
    String

    The reference to this string.

    operator+=(const StringView& str)

    Appends the specified text to this string.

    Declaration
    public String operator+=(const StringView& str)
    Parameters
    StringView str

    The text to append.

    Returns
    String

    The reference to this string.

    operator<(const Char* other)

    Declaration
    public bool operator<(const Char* other) const
    Parameters
    Char other

    Returns
    bool

    operator<(const String& other)

    Declaration
    public bool operator<(const String& other) const
    Parameters
    String other

    Returns
    bool

    operator<=(const Char* other)

    Declaration
    public bool operator<=(const Char* other) const
    Parameters
    Char other

    Returns
    bool

    operator<=(const String& other)

    Declaration
    public bool operator<=(const String& other) const
    Parameters
    String other

    Returns
    bool

    operator=(const Char c)

    Sets the text value.

    Declaration
    public String operator=(const Char c)
    Parameters
    Char c

    The other character.

    Returns
    String

    The reference to this.

    operator=(const Char* str)

    Sets the text value.

    Declaration
    public String operator=(const Char* str)
    Parameters
    Char str

    The other string.

    Returns
    String

    The reference to this.

    operator=(const char* str)

    Sets the text value.

    Declaration
    public String operator=(const char* str)
    Parameters
    char str

    The other string.

    Returns
    String

    The reference to this.

    operator=(const String& s)

    Sets the text value.

    Declaration
    public String operator=(const String& s)
    Parameters
    String s

    The other string.

    Returns
    String

    The reference to this.

    operator=(const StringView& s)

    Sets the text value.

    Declaration
    public String operator=(const StringView& s)
    Parameters
    StringView s

    The other string.

    Returns
    String

    The reference to this.

    operator=(String&& s)

    Sets the text value.

    Declaration
    public String operator=(String&& s) noexcept
    Parameters
    String s

    The other string.

    Returns
    String

    The reference to this.

    operator==(const Char* other)

    Declaration
    public bool operator==(const Char* other) const
    Parameters
    Char other

    Returns
    bool

    operator==(const String& other)

    Declaration
    public bool operator==(const String& other) const
    Parameters
    String other

    Returns
    bool

    operator>(const Char* other)

    Declaration
    public bool operator>(const Char* other) const
    Parameters
    Char other

    Returns
    bool

    operator>(const String& other)

    Declaration
    public bool operator>(const String& other) const
    Parameters
    String other

    Returns
    bool

    operator>=(const Char* other)

    Declaration
    public bool operator>=(const Char* other) const
    Parameters
    Char other

    Returns
    bool

    operator>=(const String& other)

    Declaration
    public bool operator>=(const String& other) const
    Parameters
    String other

    Returns
    bool

    Remove(int32 startIndex)

    Removes characters from the string at given location until the end.

    Declaration
    public void Remove(int32 startIndex)
    Parameters
    int32 startIndex

    The index of the first character to remove.

    Remove(int32 startIndex, int32 length)

    Removes characters from the string at given location and length.

    Declaration
    public void Remove(int32 startIndex, int32 length)
    Parameters
    int32 startIndex

    The index of the first character to remove.

    int32 length

    The amount of characters to remove.

    Right(int32 count)

    Gets the string of characters from the right (end of the string).

    Declaration
    public String Right(int32 count) const
    Parameters
    int32 count

    The characters count.

    Returns
    String

    The substring.

    Set(const Char* chars, int32 length)

    Sets an array of characters to the string.

    Declaration
    public void Set(const Char* chars, int32 length)
    Parameters
    Char chars

    The pointer to the start of an array of characters to set (UTF-16). This array need not be null-terminated, and null characters are not treated specially.

    int32 length

    The number of characters to assign.

    Set(const char* chars, int32 length)

    Sets an array of characters to the string.

    Declaration
    public void Set(const char* chars, int32 length)
    Parameters
    char chars

    The pointer to the start of an array of characters to set (ANSI). This array need not be null-terminated, and null characters are not treated specially.

    int32 length

    The number of characters to assign.

    SetUTF8(const char* chars, int32 length)

    Sets an array of characters to the string.

    Declaration
    public void SetUTF8(const char* chars, int32 length)
    Parameters
    char chars

    The pointer to the start of an array of characters to set (UTF-8). This array need not be null-terminated, and null characters are not treated specially.

    int32 length

    The number of characters to assign.

    Split(Char c, Array<String, HeapAllocation>& results)

    Splits a string into substrings that are based on the character.

    Declaration
    public void Split(Char c, Array<String, HeapAllocation>& results) const
    Parameters
    Char c

    A character that delimits the substrings in this string.

    Array<String, HeapAllocation> results

    An array whose elements contain the substrings from this instance that are delimited by separator.

    StartsWith(const StringView& prefix, StringSearchCase searchCase=StringSearchCase::CaseSensitive)

    Declaration
    public bool StartsWith(const StringView& prefix, StringSearchCase searchCase=StringSearchCase::CaseSensitive) const
    Parameters
    StringView prefix

    StringSearchCase searchCase

    Returns
    bool

    Substring(int32 startIndex)

    Retrieves substring created from characters starting from startIndex to the String end.

    Declaration
    public String Substring(int32 startIndex) const
    Parameters
    int32 startIndex

    The index of the first character to subtract.

    Returns
    String

    The substring created from String data.

    Substring(int32 startIndex, int32 count)

    Retrieves substring created from characters starting from start index.

    Declaration
    public String Substring(int32 startIndex, int32 count) const
    Parameters
    int32 startIndex

    The index of the first character to subtract.

    int32 count

    The amount of characters to retrieve.

    Returns
    String

    The substring created from String data.

    ToLower()

    Converts all uppercase characters to lowercase.

    Declaration
    public String ToLower() const
    Returns
    String

    The lowercase string.

    ToString()

    Declaration
    public String ToString() const
    Returns
    String

    ToStringAnsi()

    Declaration
    public StringAnsi ToStringAnsi() const
    Returns
    StringAnsi

    ToUpper()

    Converts all lowercase characters to uppercase.

    Declaration
    public String ToUpper() const
    Returns
    String

    The uppercase string.

    TrimToNullTerminator()

    Trims the string to the first null terminator character in the characters buffer.

    Declaration
    public void TrimToNullTerminator()

    TrimTrailing()

    Removes trailing whitespace characters from end and begin of the string.

    Declaration
    public String TrimTrailing() const
    Returns
    String

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat