Description
Finds all occurrences of a substring within a string, returning an array of all matching positions. Optionally search within a specific range.Syntax
Parameters
Returns
Type: list of numbers An array containing the zero-based indices of all occurrences of the substring. Returns an empty array if no matches are found. Returnsnull if the input string is null.
Examples
Example 1: Find All Occurrences
Example 2: Find Occurrences in Range
Example 3: Count Keyword Occurrences
Notes
- Returns
nullif input string isnull - Returns empty array if substring is not found
- Uses zero-based indexing
- The
fromparameter allows starting search from a specific position - The
toparameter limits search to a specific range - Useful for counting occurrences or analyzing text patterns
See Also
- text.indexOf - Find first occurrence only
- text.replace - Replace substring occurrences
- text.regexGroups - Find matches using regex patterns
Frequently Asked Questions
What does flex.text.indexesOf return if no matches are found?
What does flex.text.indexesOf return if no matches are found?
It returns an empty list
[].Can I limit the search to a specific range?
Can I limit the search to a specific range?
Yes. Use the optional
from and to parameters to restrict the search within a substring range.