"at" (string::at)

Returns the character at the given index idx in the string.

Synopsis

string string.at(uint idx);

Parameters

Parameter Description
idx Index within the string

Description

Returns the character at the given index idx in the string.

If idx >= length() an empty string is returned.

Since the string can contain Unicode characters, the return value is also a string representing a single Unicode character (e.g. UTF-8 multibyte encoded)

Example

main()
{
  string s = "AäΩ";
  DebugN(s.at(0));
  DebugN(s.at(1));
  DebugN(s.at(2));
}

Console output:

WCCOAui1:["A"]
WCCOAui1:["ä"]
WCCOAui1:["Ω"]

Assignment

String