Tutorial

Getting Started with Macros

Macro Editor

User Interface

Menus and Toolbar

Editing Macro Statements

Expression Editor

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: March 19, 2023
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

For

ForEach

If

Else If

Else

Switch

Case

Default

While

Expression

Comment

Break

Continue

Return

Hierarchy Objects

NotebookRoot

Notebook

SectionGroup

Section

Page

Page Objects

Title

Outline

Table

Column

Row

Cell

Paragraph

Text

Image

EmbeddedFile

Tag

Other Objects

DialogBox

MacroMenu

Window

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Macro Menu Functions

Object Functions

String Functions

Window Functions