String 2 Ints:
The String2Ints_xuhuan1024 node is designed to extract integers from a given string, making it particularly useful for scenarios where you need to parse and utilize numerical data embedded within text. This node leverages regular expressions to identify and extract up to four integers from the input string, including negative numbers. If fewer than four integers are found, it defaults to returning a predefined set of values. This functionality is beneficial for AI artists and developers who need to process text data and convert it into numerical form for further analysis or processing, such as in storyboard extraction or other creative computational tasks.
String 2 Ints Input Parameters:
text
The text parameter is a string input from which the node will attempt to extract integers. This parameter is crucial as it serves as the source of data for the node's operation. The input should be a single-line string, as multiline input is not supported. The content of this string can include any characters, but the node specifically targets sequences of digits, optionally preceded by a minus sign, to identify integers. There are no explicit minimum or maximum values for this parameter, but the effectiveness of the node depends on the presence of integer-like patterns within the text.
String 2 Ints Output Parameters:
int1
The int1 output represents the first integer extracted from the input string. If the string contains fewer than four integers, this output defaults to 0. This output is essential for capturing the primary numerical data from the text.
int2
The int2 output is the second integer extracted from the input string. Similar to int1, if fewer than two integers are found, this output defaults to 0. It provides additional numerical data extracted from the text.
int3
The int3 output is the third integer extracted from the input string. If fewer than three integers are present, this output defaults to 1. This output further extends the numerical data extracted from the text.
int4
The int4 output is the fourth integer extracted from the input string. If fewer than four integers are found, this output defaults to 1. This output completes the set of numerical data extracted from the text.
String 2 Ints Usage Tips:
- Ensure that the input string contains clear integer patterns to maximize the effectiveness of the node. This includes sequences of digits that may be preceded by a minus sign for negative numbers.
- Use this node in conjunction with other text processing nodes to prepare and clean your input data, ensuring that the integers you wish to extract are formatted correctly within the string.
String 2 Ints Common Errors and Solutions:
No integers found in the input string
- Explanation: The input string does not contain any recognizable integer patterns.
- Solution: Verify that the input string includes sequences of digits, possibly with a minus sign for negative numbers. Adjust the string content to include integers if necessary.
Input string is too short or empty
- Explanation: The input string is either empty or too short to contain any integers.
- Solution: Provide a longer string with potential integer values to ensure the node can perform its extraction function effectively.
