ProtoFlux:String To UTF32: Difference between revisions

From Resonite Wiki
Created page with "{{#Invoke:ProtoFlux|GenerateUI |Name=String To UTF32 |Category=Characters |Inputs= [ {"Name": "String", "Type": "String"}, {"Name": "Index", "Type": "int"} ] |Outputs= [ {"Name": "*", "Type": "int"} ] |}} <code>String To UTF32</code> returns the code point (UTF-32 value) of a character or surrogate pair in a Type:string. == Inputs == === String (String) === The string to retrieve the character or surrogate pair from. === Index (Type:Int|int..."
 
m style & formatting
 
(2 intermediate revisions by the same user not shown)
Line 13: Line 13:
|}}
|}}


<code>String To UTF32</code> returns the code point ([[UTF-32]] value) of a character or surrogate pair in a [[Type:string|string]].
The '''String To UTF32''' returns the code point ([[UTF-32]] value) of a character or surrogate pair in a [[Type:string|string]].


== Inputs ==
== Inputs ==


=== String ([[Type:String|String]]) ===
=== String ([[Type:string|string]]) ===
The string to retrieve the character or surrogate pair from.
The string to retrieve the character or surrogate pair 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>String</code>.
 
{{Warning:String Outside BMP}}


== Outputs ==
== Outputs ==


=== * ([[Type:int|int]]) ===
=== * ([[Type:int|int]]) ===
The code point ([[UTF-32]] value) of a character or surrogate pair at the position in the string.
The code point of the character or surrogate pair at the index in the string.
 
The value <code>0</code> is returned instead if one of the following is true:
 
* <code>Index</code> is greater than or equal to the [[ProtoFlux:String Length|String Length]].
* <code>Index</code> points to a [https://en.wikipedia.org/wiki/Surrogate_code_points#Surrogates low surrogate].
* <code>Index</code> points to a high surrogate without a low surrogate following it.


If <code>String</code> is null or the <code>Index</code> is outside the string, the value <code>0</code> is returned instead.
== See Also ==
* [https://learn.microsoft.com/en-us/dotnet/api/system.char.converttoutf32#system-char-converttoutf32(system-string-system-int32) Microsoft documentation for the <code>Char.ConvertToUtf32(String, Int32)</code> method].


[[Category:ProtoFlux:Strings:Characters]]
[[Category:ProtoFlux:Strings:Characters]]

Latest revision as of 19:46, 3 June 2024

String To UTF32
String
*
Index
Characters

The String To UTF32 returns the code point (UTF-32 value) of a character or surrogate pair in a string.

Inputs

String (string)

The string to retrieve the character or surrogate pair from.

Index (int)

The 0-indexed character to retrieve from String.

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.

Outputs

* (int)

The code point of the character or surrogate pair at the index in the string.

The value 0 is returned instead if one of the following is true:

  • Index is greater than or equal to the String Length.
  • Index points to a low surrogate.
  • Index points to a high surrogate without a low surrogate following it.

See Also