Skip to content

Pad

What It Does

Adds characters to the beginning or end of a string until it reaches the desired length. This is useful for aligning text, creating fixed-width formats, or visual styling.

Inputs

NameDescriptionTypeRequired
stringThe text to padStringYes
lengthThe target length for the padded stringNumberYes
characterThe character to pad withStringYes
positionWhere to add padding (start or end)StringNo

Outputs

NameDescriptionType
stringThe padded textString

How to Use It

  1. Drag the Pad node into your graph.
  2. Connect the text you want to pad to the "string" input. For e.g., name.
  3. Set the desired "length" for the final string. For e.g., 10.
  4. Specify the "character" to use for padding (only the first character will be used).
  5. Select the "position" to add padding (start or end).

Tips

  • If your string is already longer than the specified length, it won't be truncated.
  • Only the first character of the "character" input will be used for padding.

See Also

Use Cases

  • UI Display: Create fixed-width elements for consistent visual alignment.
  • Code Formatting: Format code identifiers with consistent spacing.
  • Data Export: Prepare fixed-width fields for legacy systems or data exchange formats.