ProtoFlux:Get Character: Difference between revisions

From Resonite Wiki
m chore: use standard string warning
m null/empty string has string length 0, so it's implied
Line 17: Line 17:
== Inputs ==
== Inputs ==


=== Str ([[Type:String|String]]) ===
=== Str ([[Type:string|string]]) ===
The string to retrieve a character from.
The string to retrieve a character from.


=== Index ([[Type:Int|int]]) ===
=== Index ([[Type:int|int]]) ===
The 0-indexed character to retrieve from <code>Str</code>.
The 0-indexed character to retrieve from <code>Str</code>.


== Outputs ==
== Outputs ==


=== * ([[Type:Char|char]]) ===
=== * ([[Type:char|char]]) ===
The character from <code>Str</code> at index <code>Index</code>. If <code>Index</code> is greater than or equal to the length of <code>Str</code>, or if <code>Str</code> is empty or null, the output will be a character with value <code>0</code>.
The character from <code>Str</code> at index <code>Index</code>. If <code>Index</code> is either negative or greater than or equal to the [[ProtoFlux:String Length|length]] of <code>Str</code>, the output will be a character with value <code>0</code>.


{{Warning:String Outside BMP}}
{{Warning:String Outside BMP}}

Revision as of 18:58, 28 April 2024

Get Character
Str
*
Index
Characters

Get Character is a ProtoFlux node that retrieves an arbitrary character from a given string.

Inputs

Str (string)

The string to retrieve a character from.

Index (int)

The 0-indexed character to retrieve from Str.

Outputs

* (char)

The character from Str at index Index. If Index is either negative or greater than or equal to the length of Str, the output will be a character with value 0.

This node deals with individual chars of a string, whether by way of indexing a string or by returning a char. This may result in unintuitive behavior with strings containing characters that reside outside the Basic Multilingual Plane, such as "mismatched" indices or returning an invalid char. For more information, see the type page for String.

Examples