ComfyUI Node: ljust

Class Name

Basic data handling: StringLjust

Category
Basic/STRING
Author
StableLlama (Account age: 861days)
Extension
Basic data handling
Latest Updated
2026-05-07
Github Stars
0.04K

How to Install Basic data handling

Install this extension via the ComfyUI Manager by searching for Basic data handling
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter Basic data handling 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
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ljust Description

StringLjust node left-aligns strings within a specified width, using customizable padding characters.

ljust:

The StringLjust node is designed to left-align a given string within a specified field width, providing a simple yet effective way to format text for alignment purposes. This node is particularly useful when you need to ensure that text appears consistently aligned in a user interface or when preparing data for display in tabular formats. By default, the node uses spaces to pad the string to the desired width, but you can specify a different character for padding if needed. This flexibility allows you to customize the appearance of your text output, making it a versatile tool for text formatting tasks.

ljust Input Parameters:

string

This parameter represents the input string that you want to left-align. It is the main text content that will be formatted by the node. The default value is an empty string, and it is required for the node to function.

width

The width parameter specifies the total field width within which the input string will be left-aligned. If the specified width is greater than the length of the input string, the node will add padding characters to the right of the string to reach the desired width. The default value is 10, and the minimum value is 0. This parameter is crucial for determining how much space the string will occupy.

fillchar

This optional parameter allows you to specify a character to use for padding the string. By default, a space character is used, but you can choose any single character to customize the padding. If you provide a string longer than one character, only the first character will be used. This parameter gives you control over the appearance of the padded area.

ljust Output Parameters:

string

The output is a single string that has been left-aligned within the specified width. If the input string is shorter than the specified width, the output will include the input string followed by the padding characters. If the input string is longer than the specified width, the output will be the input string itself, unchanged. This output is essential for ensuring that your text is formatted consistently according to your alignment requirements.

ljust Usage Tips:

  • Use the width parameter to ensure consistent alignment of text in user interfaces or reports, especially when dealing with variable-length strings.
  • Customize the fillchar parameter to add visual distinction to your text output, such as using dots or dashes for padding instead of spaces.

ljust Common Errors and Solutions:

Invalid fill character length

  • Explanation: The fillchar parameter must be a single character. If a longer string is provided, only the first character will be used.
  • Solution: Ensure that the fillchar parameter is a single character to avoid unexpected results.

Width smaller than string length

  • Explanation: If the width parameter is smaller than the length of the input string, the output will be the input string itself, as no padding is needed.
  • Solution: Adjust the width parameter to be equal to or greater than the length of the input string if padding is desired.

ljust Related Nodes

Go back to the extension to check out more related nodes.
Basic data handling
RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.

ljust