Welcome to Catalog Tips
Search more than 200 articles to learn more about creating and automating your product catalogs
Tip: Start typing in the input box for immediate search results.
LASTINDEXOF – Find character index of last instance of a string
Overview
This Custom Field returns the character index of the last instance of one string within another, or -1 if the last string does not contain the second.
Syntax
LASTINDEXOF(‘SearchIn‘, ‘SearchFor‘,StartIndex)
LASTINDEXOF(FIELDSTR(Description),‘A’, n)
| Element | Description |
|---|---|
| SearchIn | A string to search within. |
| SearchFor | A string to serach for. |
| StartIndex | The character index to start searching at. Default is 0. (Optional field.) |
Examples
LASTINDEXOF(FIELDSTR(‘Body Copy’), ‘Apple’)
|
Body Copy |
LASTINDEXOF(FIELDSTR(‘Body Copy’), ‘Apple’) |
|
Apple iMac |
0 |
|
I like Apples |
7 |
|
Dell Computer |
-1 |
|
Apple iMac by Apple, Inc. |
14 |
LASTINDEXOF(FIELDSTR(‘Body Copy’), ‘Apple’, 3)
|
Body Copy |
LASTINDEXOF(FIELDSTR(‘Body Copy’), ‘Apple’, 3) |
|
Apple iMac |
0 |
|
I like Apples |
-1 |
|
Dell Computer |
-1 |
|
Apple iMac by Apple, Inc. |
0 |
