ProtoFlux:Format String: Difference between revisions

From Resonite Wiki
add format node
 
Added an input description for this node.
 
(3 intermediate revisions by 3 users not shown)
Line 14: Line 14:
|}}
|}}


This node simply calls the C# [https://learn.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.7.2 String.Format] function using the provided parameters.
This node simply calls the C# [https://learn.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.7.2 String.Format] function using the provided parameters. It allows you to take a string like "I am a {0} who likes to do {1} while {2}" And populate {0}, {1}, and {2} with values. If you plug any value into the list of inputs for the Parameters, it will auto add a cast node into an [[Type:Object|object]].
 
For example using the string <code>"The number {0} is on the {1} hand and the fact it's enabled is {2}."</code> for Format. Then Plugging in a [[Type:Float|float (1.25)]] for the first input, Then a [[Type:Chirality|Chirality (Left)]] to the second, then a [[Type:Bool|Boolean (True)]] will result in the output <code>"The number 1.25 is on the Left hand and the fact it's enabled is True."</code>


== Inputs ==
== Inputs ==
Line 27: Line 29:


Nodes that output this type can be found in [[:Category:ProtoFlux:Strings:Localization|Strings/Localization]]
Nodes that output this type can be found in [[:Category:ProtoFlux:Strings:Localization|Strings/Localization]]
=== Parameters ([[Type:Object|Object]]) ===
A list of object-type parameters that can dynamically change this formatted string of text.


== Outputs ==
== Outputs ==

Latest revision as of 05:29, 26 June 2024

Format
Format
*
FormatProvider
Parameters
+
-
Formatting

This node simply calls the C# String.Format function using the provided parameters. It allows you to take a string like "I am a {0} who likes to do {1} while {2}" And populate {0}, {1}, and {2} with values. If you plug any value into the list of inputs for the Parameters, it will auto add a cast node into an object.

For example using the string "The number {0} is on the {1} hand and the fact it's enabled is {2}." for Format. Then Plugging in a float (1.25) for the first input, Then a Chirality (Left) to the second, then a Boolean (True) will result in the output "The number 1.25 is on the Left hand and the fact it's enabled is True."

Inputs

Format (String)

A composite format string.

FormatProvider (IFormatProvider)

An object that supplies culture-specific formatting information.

Nodes that output this type can be found in Strings/Localization

Parameters (Object)

A list of object-type parameters that can dynamically change this formatted string of text.

Outputs

* (String)

The formatted string.