Skip to content

String Indent

The string::indent function adds a specified number of spaces to the beginning of each line in a string.

Syntax

string::indent(<spaces>, <string>)

Parameters

  • spaces: The number of spaces to add to each line.
  • string: The input string to indent.

Returns

  • String: The indented string.

Example

Try it out below!
string::indent(4, "Hello\nWorld")

This function is useful for formatting multi-line strings or aligning text in generated outputs.