String

This is the built-in string class (and the one used by GDScript). It supports Unicode and provides all necessary means for string handling. Strings are reference counted and use a copy-on-write approach, so passing them around is cheap in resources.

Constructors

this
this(godot_string str)
Undocumented in source.
this
this(S str)

wchar_t constructor. S can be a slice or a null-terminated pointer.

this
this(S str)

UTF-8 constructor. S can be a slice (like string) or a null-terminated pointer.

Destructor

~this
~this()
Undocumented in source.

Postblit

this(this)
this(this)

postblit (Vector is CoW, so no data copying is done)

Members

Aliases

toString
alias toString = data
Undocumented in source.

Functions

data
immutable(wchar_t)[] data()

Returns a slice of the wchar_t data without the zero terminator.

empty
bool empty()
format
String format(V values)
Undocumented in source. Be warned that the author may not have intended to support it.
format
String format(V values, String placeholder)
Undocumented in source. Be warned that the author may not have intended to support it.
length
size_t length()

Returns the length of the wchar_t array, minus the zero terminator.

opAssign
void opAssign(String other)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinary
String opBinary(String other)
Undocumented in source. Be warned that the author may not have intended to support it.
opCmp
int opCmp(String s)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(String other)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
wchar_t opIndex(size_t idx)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
wchar_t opIndex(size_t idx)
Undocumented in source. Be warned that the author may not have intended to support it.
opOpAssign
void opOpAssign(String other)
Undocumented in source. Be warned that the author may not have intended to support it.
ptr
immutable(wchar_t)* ptr()

Returns a pointer to the wchar_t data. Always zero-terminated.

toHash
hash_t toHash()
Undocumented in source. Be warned that the author may not have intended to support it.
utf8
CharString utf8()
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_godot_string
godot_string _godot_string;
Undocumented in source.

Meta