ProtoFlux:Substring: Difference between revisions

From Resonite Wiki
more clear description, example
add warning about strings with chars outside bmp
 
Line 29: Line 29:


Length of output substring.
Length of output substring.
{{Template:Note|Strings are UTF-16 encoded, and <code>Length</code> represents the amount of UTF16 codepoints in the output string. Usage of this node on a string containing characters outside the [https://en.wikipedia.org/wiki/Plane_(Unicode)#Basic_Multilingual_Plane Basic Multilingual Plane] may result in confusing behavior, such as the amount of characters in the output string being less than the <code>Length</code> value.|warning}}


== Outputs ==
== Outputs ==

Latest revision as of 03:34, 23 February 2024

Substring
Str
*
StartIndex
Length
Strings

Substring is a ProtoFlux node that allows one to get an arbitrary portion of a provided String.

Inputs

Str (String)

The string to remove a segment from.

StartIndex (int)

The 0-indexed starting point of retrieval from Str.

Length (int)

Length of output substring.

Strings are UTF-16 encoded, and Length represents the amount of UTF16 codepoints in the output string. Usage of this node on a string containing characters outside the Basic Multilingual Plane may result in confusing behavior, such as the amount of characters in the output string being less than the Length value.

Outputs

* (String)

A segment of Str starting at StartIndex with length Length. If the segment goes past the end of Str, the output is truncated at the end of Str. If Length is less than 1, the output will be an Empty String.

Examples