Difference between revisions of "Format (LogiX node)"
(Change to reflect 1 initial parameter as of build 2021.6.18.4) |
AshtonSparx (talk | contribs) |
||
Line 19: | Line 19: | ||
The output will be ''null'' if a pair of curly braces is present without a valid parameter value e.g. "{}" or "{1}" if there is only a <code>Parameters.[0]</code> input. | The output will be ''null'' if a pair of curly braces is present without a valid parameter value e.g. "{}" or "{1}" if there is only a <code>Parameters.[0]</code> input. | ||
− | There are many additional options which can be used to control how parameter inputs are formatted. For these more advanced options, much of the C# documentation for the [https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.6.2 Format method] is applicable. For example there are many options for formatting numeric data as detailed [https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings here]. | + | There are many additional options which can be used to control how parameter inputs are formatted. For these more advanced options, much of the C# documentation for the [https://docs.microsoft.com/en-us/dotnet/api/system.string.format?view=netframework-4.6.2 Format method] is applicable. For example there are many options for formatting numeric data as detailed [https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings here]. For standard time & date formatting, [https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-date-and-time-format-strings here] For custom numeric formatting, [https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-numeric-format-strings here] and custom date/time formatting, [https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings here]. |
== Examples == <!--T:4--> | == Examples == <!--T:4--> |
Revision as of 03:33, 30 October 2021
Format | ||
---|---|---|
Inputs | ||
String | Format | |
Outputs | ||
String | Str |
The Format node generates the output Str
by inserting the input parameters into specified points in the input Format
string.
Usage
The node initially spawns with one parameter input. Use the + or - buttons on the node add or remove parameter inputs.
Parameter inputs are inserted into the Format
string at positions specified by curly braces '{}'. For example, if the first parameter input Parameters.0
is a string with the value "World" and the Format
string is "Hello {0}!", the output Str
will be "Hello World!".
The output will be null if a pair of curly braces is present without a valid parameter value e.g. "{}" or "{1}" if there is only a Parameters.[0]
input.
There are many additional options which can be used to control how parameter inputs are formatted. For these more advanced options, much of the C# documentation for the Format method is applicable. For example there are many options for formatting numeric data as detailed here. For standard time & date formatting, here For custom numeric formatting, here and custom date/time formatting, here.
Examples
Tutorial from ProbablePrime which shows some basic and more advanced options: