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_Substring

String_Substring

Returns a part of the given string. The part starts from the 0-based offset and the length of it is count.

Syntax

String String_Substring(
	String string, 
	Numeric offset, 
	Numeric count)

Parameters

String string
String to return the part of.
Numeric offset
0-based start index of the substring. If non-negative, the substring will start this number of characters counted from the beginning of the string. If negative, the substring will start this number of characters counted from the end of the string.
Numeric count
Length of the substring.

Examples

// 7 characters starting at index 5 $substring = String_Substring("The quick brown fox", 5, 7) // $substring is "uick br" // 4 characters starting from the 8th character from the end $substring = String_Substring("The quick brown fox", -8, 4) // $substring is "rown" // First 10 characters $substring = String_Substring("The quick brown fox", 0, 10) // $substring is "The quick " // Last 5 characters $substring = String_Substring("The quick brown fox", -5, 5) // $substring is "n fox"

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