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

Sorting objects

Sample Macros

Concepts

Expressions

Objects

Properties

Variables

Data Types

Arrays

Functions

Literals

Operators

Comments

Last updated on: April 17, 2021
Also available as a single HTML file

Onetastic Macro Documentation > Functions > String Functions > String_FindLastNotOf

String_FindLastNotOf

Finds the last character that does not match any of given the characters in an input string. Returns true if it was found and the offset it was found at, false otherwise.

Syntax

Bool String_FindLastNotOf(
	String string, 
	String characters, 
	Numeric offset, 
	out Numeric foundAt)

Parameters

String string
String to search in.
String characters
The set of characters to look for.
Numeric offset
Offset of the input string to start search from. If non-negative, search will start this number of characters counted from the beginning of the string, going backwards. If negative, the search will start this number of characters counted from the end of the string, going backwards.
out Numeric foundAt
If a character that does not match any of the given characters is found, the offset of the last occurence is stored in this variable.

Examples

// 1 2 3 4 // 01234567890123456789012345678901234567890 $string = "a4 b6 c5 4a b6 d5 f6 d7 e4 b6 c2 56 d4 5a" // ^ ^ ^ ^ // Instances of c, 7 and f are marked with ^ // Find first instance of anything but a,b,d,e,2,4,5,6 String_FindLastNotOf($string, "abde2456", 0, $foundAt) // Returns true, $foundAt is 30 // Find last instance within the first 20 characters String_FindLastNotOf($string, "abde2456", 9, $foundAt) // Returns true, $foundAt is 18 // Find last instance skipping the last 30 characters String_FindLastNotOf($string, "abde2456", -30, $foundAt) // Returns true, $foundAt is 6 // Not found String_FindLastNotOf($string, "abcdef24567", 0, $foundAt) // Returns false, $foundAt is not modified

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

Functions

Array Functions

Color Functions

Data Store Functions

Date/Time Functions

Dialog Box Functions

Macro Execution Functions

Object Functions

String Functions