ComfyUI  >  Nodes  >  WAS Node Suite >  Text String Truncate

ComfyUI Node: Text String Truncate

Class Name

Text String Truncate

Category
WAS Suite/Text/Operations
Author
WASasquatch (Account age: 4688 days)
Extension
WAS Node Suite
Latest Updated
8/25/2024
Github Stars
1.1K

How to Install WAS Node Suite

Install this extension via the ComfyUI Manager by searching for  WAS Node Suite
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter WAS Node Suite in the search bar
After installation, click the  Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • High-speed GPU machines
  • 200+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 50+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

Text String Truncate Description

Truncate text strings to specified length with flexibility in truncation options for various text processing tasks.

Text String Truncate:

The Text String Truncate node is designed to help you manage and manipulate text by truncating it to a specified length. This node is particularly useful when you need to shorten text strings for various applications, such as fitting text into a limited space or ensuring consistency in text length. It offers flexibility by allowing you to truncate text either from the beginning or the end and by characters or words. This functionality ensures that you can tailor the truncation process to meet your specific needs, making it a versatile tool for text processing tasks.

Text String Truncate Input Parameters:

text

This parameter represents the main text string that you want to truncate. It is a required input and must be provided for the node to function. The text can be any string that you need to shorten.

truncate_by

This parameter determines whether the truncation should be based on characters or words. You can choose between characters and words. Selecting characters will truncate the text by the specified number of characters, while selecting words will truncate the text by the specified number of words.

truncate_from

This parameter specifies the direction from which the text should be truncated. You can choose between end and beginning. Selecting end will truncate the text from the end, while selecting beginning will truncate the text from the beginning.

truncate_to

This parameter defines the maximum length to which the text should be truncated. It accepts an integer value, with a default of 10. The value can range from -99999999 to 99999999, allowing for both positive and negative truncation lengths.

text_b

This is an optional parameter that allows you to provide a second text string for truncation. If provided, this text will also be truncated according to the same settings as the main text.

text_c

This is an optional parameter that allows you to provide a third text string for truncation. If provided, this text will also be truncated according to the same settings as the main text.

text_d

This is an optional parameter that allows you to provide a fourth text string for truncation. If provided, this text will also be truncated according to the same settings as the main text.

Text String Truncate Output Parameters:

text

The primary output is the truncated version of the main text string. This output reflects the text after it has been shortened according to the specified parameters.

text_b

If the optional text_b parameter was provided, this output will be the truncated version of the second text string.

text_c

If the optional text_c parameter was provided, this output will be the truncated version of the third text string.

text_d

If the optional text_d parameter was provided, this output will be the truncated version of the fourth text string.

Text String Truncate Usage Tips:

  • To ensure consistent text length across multiple strings, provide the same truncation settings for all text inputs.
  • Use the truncate_by parameter to switch between character-based and word-based truncation depending on your specific needs.
  • When truncating from the beginning, ensure that the most important part of your text is at the end to avoid losing critical information.

Text String Truncate Common Errors and Solutions:

Invalid mode. 'mode' must be either 'beginning' or 'end'.

  • Explanation: This error occurs when an invalid value is provided for the truncate_from parameter.
  • Solution: Ensure that the truncate_from parameter is set to either beginning or end.

Invalid truncate_by. 'truncate_by' must be either 'characters' or 'words'.

  • Explanation: This error occurs when an invalid value is provided for the truncate_by parameter.
  • Solution: Ensure that the truncate_by parameter is set to either characters or words.

Text String Truncate Related Nodes

Go back to the extension to check out more related nodes.
WAS Node Suite
RunComfy

© Copyright 2024 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals.