Set Text With Number:
The Sage_SetTextWithNum node is designed to facilitate the creation of text strings that are dynamically constructed by appending a numerical value to a base text. This node is particularly useful when you need to generate text outputs that include numerical data, such as scores, counts, or any other numeric information, seamlessly integrated into a textual context. By allowing you to specify a prefix and suffix, this node provides flexibility in formatting the final output, making it adaptable to various use cases where text and numbers need to be combined. The primary goal of this node is to streamline the process of text generation with embedded numerical values, enhancing the efficiency and effectiveness of your text-based workflows.
Set Text With Number Input Parameters:
str
This parameter represents the main text content that you want to set. It serves as the core of the output string, to which a number will be appended. The input is a string and can be multiline, allowing for complex text structures. There is no minimum or maximum length specified, and it defaults to an empty string if not provided.
prefix
The prefix parameter allows you to add a string at the beginning of the main text. This can be useful for adding context or labels to the text. It is optional and can be multiline. If not specified, it defaults to an empty string.
suffix
Similar to the prefix, the suffix parameter lets you append a string to the end of the main text, just before the number. This can be used to add units or additional context to the number. It is optional and can be multiline, defaulting to an empty string if not provided.
num_type
This parameter determines the type of number to be appended to the text. It offers two options: float and int. Depending on the selection, you can input a floating-point number or an integer. The float option allows for a default value of 0.0 with a step of 0.01, while the int option defaults to 0. This flexibility enables precise control over the numerical data included in the output.
Set Text With Number Output Parameters:
str_out
The str_out parameter is the final output of the node, which is a string that combines the prefix, main text, suffix, and the appended number. This output is crucial as it represents the complete text with the integrated numerical value, ready for use in subsequent processes or displays. The output is a single string that reflects the inputs provided, ensuring that the text and number are seamlessly combined.
Set Text With Number Usage Tips:
- Use the
prefixandsuffixparameters to add context to your text, such as units or labels, which can make the output more informative and user-friendly. - When dealing with floating-point numbers, consider the precision required for your application and adjust the
num_typeinput accordingly to ensure the output meets your needs.
Set Text With Number Common Errors and Solutions:
Missing str input
- Explanation: The main text input is missing, resulting in an incomplete output.
- Solution: Ensure that you provide a valid string for the
strparameter to form the base of your output.
Invalid num_type selection
- Explanation: The
num_typeinput is not correctly specified, leading to errors in number conversion. - Solution: Verify that the
num_typeis set to eitherfloatorintand that the corresponding number input is valid.
Number conversion error
- Explanation: The number provided does not match the expected type (e.g., a non-integer value for
inttype). - Solution: Check the number input to ensure it matches the selected
num_typeand adjust as necessary.
