ProtoFlux:Substring: Difference between revisions

From Resonite Wiki
Create Substring
 
more clear description, example
Line 14: Line 14:
|}}
|}}


Substring is a ProtoFlux node that allows you to get part of a provided Str ([[Type:String|String]]) of a given Length ([[Type:Int|int]]) starting at StartIndex ([[Type:Int|int]]).
Substring is a ProtoFlux node that allows one to get an arbitrary portion of a provided String.


== Inputs ==
== Inputs ==
Line 24: Line 24:
=== StartIndex ([[Type:Int|int]]) ===
=== StartIndex ([[Type:Int|int]]) ===


The starting point of retrieval from Str ([[Type:String|String]]).
The 0-indexed starting point of retrieval from <code>Str</code>.


=== Length ([[Type:Int|int]]) ===
=== Length ([[Type:Int|int]]) ===


How long of a segment to get from Str ([[Type:String|String]]).
Length of output substring.


== Outputs ==
== Outputs ==
Line 34: Line 34:
=== * ([[Type:String|String]]) ===
=== * ([[Type:String|String]]) ===


A segment of Str ([[Type:String|String]]) starting at StartIndex ([[Type:Int|int]]) to Length ([[Type:Int|int]]) + StartIndex ([[Type:Int|int]]).
A segment of <code>Str</code> starting at <code>StartIndex</code> with length <code>Length</code>. If the segment goes past the end of <code>Str</code>, the output is truncated at the end of <code>Str</code>. If <code>Length</code> is less than <code>1</code>, the output will be an [[ProtoFlux:Empty_String|Empty String]].


== Examples ==
== Examples ==
<gallery widths=480px heights=480px>
<gallery widths=480px heights=320px>
File:Protoflux_example_Substring.webp|Substring being used to tell what's inside of a string in a provided segment.
File:Protoflux_example_Get_Character_Substring.webp|alt=The substring node has String input "Cheese Mobile", Start Index 4, and Length 5. The output string is "se Mo".|Substring being used to tell what's inside of a string in a provided segment, as well as its relation to [[ProtoFlux:Get_Character|Get Character]].
</gallery>
</gallery>


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

Revision as of 20:54, 20 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.

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