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_Trim

String_Trim

Removes whitespace (or other characters) from the beginning and/or end of a string and returns the resulting string.

Syntax

String String_Trim(
	String string, 
	String characters, 
	String trimDirection)

Parameters

String string
String to be trimmed.
String characters
Set of characters to be trimmed. If left empty, following characters will be removed: Space (ASCII 32), Tab (ASCII 9), New Line (ASCII 10), Carriage Return (ASCII 13), Vertical Tab (ASCII 11).
String trimDirection
Direction of the trim. Can be "left", "right" or "both".

Examples

$string = " The quick brown fox " String_Trim($string, "", "left") // "The quick brown fox\r\n" String_Trim($string, "", "right") // " \tThe quick brown fox" String_Trim($string, "", "both") // "The quick brown fox" String_Trim("The quick brown fox", "Txohef ", "both") // "quick brown"

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