---
schema_version: "1"
id: a50ac677b60320c2341cc48add9fa8ed64b68096b434e6118fc25a8bd0d643c5
title: index_of({source_str}, {search_str}, [{position},{occurrence}])
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_sql/guides/bi-sql-string-index-of.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-sql/guide/bi-sql-string-index-of.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: dfc9538619f418e3d8b3fa1264f59d0a8e8aa315f081ff48341b9e3c93dfbfb5
products:
  - SQL for Analytics Developer Guide
  - analytics
---

# index_of({source_str}, {search_str}, [{position},{occurrence}])

Returns a boolean indicating whether a string ends with the search string.

`INDEX_OF()` follows this syntax.

- _source_str_

  - : The string to be searched.

- _search_str_

  - : The string to search for within the source string.

- _position_

  - : Optional. The index from which to begin searching the string. The default _position_ is set to 1.

- _occurrence_

  - : Optional. If there’s more than one instance of the searched string, you can specify occurrence to choose which instance to return. The default _occurrence_ is set to 1.

The function returns 0 if _search_str_ isn’t found.

## Example

This example returns the index of the second occurrence of the letter “`e`” in the first five cities in the dataset.

```nolang
SELECT City, INDEX_OF(City, 'e', 1, 2) as "indexValue"
FROM "Superstore"
LIMIT 5;
```

| City            | indexValue |
| --------------- | ---------- |
| Henderson       | 5          |
| Henderson       | 5          |
| Los Angeles     | 10         |
| Fort Lauderdale | 15         |
| Fort Lauderdale | 15         |
