Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macros

Macro Debugging

How To

Using variables

Finding and modifying objects

Creating new page content

Asking for user input

Storing persistent data

Using binary data

Sorting objects

Macro menus

Bulleted and numbered lists

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: September 02, 2024
Also available as a single HTML file

Onetastic Macro Documentation > Functions > String Functions > String_Pad

String_Pad

Pads a string to a certain length with another string and returns the resulting string.

Syntax

String String_Pad(
	String string, 
	String padString, 
	Numeric length, 
	String padDirection)

Parameters

String string
String to be padded with padString.
String padString
String to pad with.
Numeric length
String will be at this length after padding. If this is smaller than the length of the original string, no padding happens.
String padDirection
Direction of the padding. Can be "left", "right" or "both".

Examples

// Pad at the end String_Pad("pqrst", "AB", 10, "right") // "pqrstABABA" // Pad at the beginning String_Pad("pqrst", "AB", 10, "left") // "ABABApqrst" // Pad both sides String_Pad("pqrst", "AB", 10, "both") // "ABpqrstABA"

Reference

Statements

Hierarchy Objects

Page Objects

Other Objects

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

Special Functions

String Functions

Window Functions