String Format
Formats a string by substituting values into a template.
This node formats a string using a template and a series of substitution values, similar to C's printf or Go's fmt.Sprintf.
The fmt input defines the template string, which can contain format "verbs". Each verb corresponds to an input from the substitutes array in order. The node will produce an error if the number of verbs does not exactly match the number of substitution inputs.
If the format string does not contain any format verbs (like %s), the original format string is output directly, and the substitutes inputs are ignored.
Example#
- Format String:
File saved to %s (frame %d) - Substitutes:
[/path/to/render.exr, 1001] - Result:
File saved to /path/to/render.exr (frame 1001)
Common Format Verbs#
| Verb | Description | | :--- | :-------------------------- | | %v | The value in a default format | | %s | A string | | %d | A base-10 integer | | %f | A floating-point number | | %% | A literal percent sign |
Inputs#
| Port | Description |
|---|---|
The format string containing format verbs (e.g., %s, %d, %f). |
|
| The values to substitute into the format string. |
Outputs#
| Port | Description |
|---|---|
| The formatted string. |
ID: core/string-fmt@v1