String to Float List(StringToFloatList)
This node splits the input string into multiple substrings by recognizing commas (`,`) as delimiters, then trims whitespace from both ends of each substring and attempts to convert them into floating-point (float) values.
String To Float List
The String to Float List node identifies commas (,) within the input string as delimiters, splits the string into multiple substrings, trims whitespace from both ends of each substring, and attempts to convert them to the float data type.
The String to Float List node is a data conversion tool. Its core function is to parse a user-input text string according to specific rules and convert it into a list of floating-point numbers. It acts as a bridge between textual data and numerical data, simplifying the process of batch parameter setting in workflows.
Node Functionality
This node identifies commas (,) within the input string as delimiters, splits the string into multiple substrings, trims whitespace from both ends of each substring, and attempts to convert them to the float data type. The core of its technical implementation relies on the string split method and type conversion. It supports user input of any numerical text separated by commas.
Node Parameter Description - String to Float List
Parameters
| Parameter Name | Data Type | Required | Default Value | Range/Options | Description |
|---|---|---|---|---|---|
string | STRING | Yes | 1, 2, 3 | - | Input parameter string: Used to input the text string to be converted. The string should separate numerical values with commas, e.g., "1.0, 2.5, -3.14". |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| FLOAT | FLOAT | Output parameter FLOAT: Outputs the list of floating-point numbers converted from the input string. |
Usage Scenarios
In practical applications, this node is commonly used in scenarios where a set of numerical parameters needs to be provided to other nodes. For example, when controlling keyframe parameters for image generation or providing a series of intensity values for an effect node, users can directly input text like "0.1, 0.5, 0.9" into this node's input field. The node will then output the corresponding list of floating-point numbers for use by downstream nodes.
Notes
The input string must ensure that each part separated by a comma can be successfully converted to a float; otherwise, a runtime error will occur. For instance, inputs containing letters or illegal symbols cannot be processed.
String to Float List Node Source Code Link
The String to Float List node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.