Skip to content

Commit 6931681

Browse files
committed
Improved Acrolinx score
1 parent 5a6b4b3 commit 6931681

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

articles/cosmos-db/sql/sql-query-index-of.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,52 @@ author: ginamr
55
ms.service: cosmos-db
66
ms.subservice: cosmosdb-sql
77
ms.topic: conceptual
8-
ms.date: 09/13/2019
8+
ms.date: 08/30/2022
99
ms.author: girobins
1010
ms.custom: query-reference
1111
---
12+
1213
# INDEX_OF (Azure Cosmos DB)
14+
1315
[!INCLUDE[appliesto-sql-api](../includes/appliesto-sql-api.md)]
1416

15-
Returns the starting position of the first occurrence of the second string expression within the first specified string expression, or -1 if the string is not found.
16-
17+
Returns the starting position of the first occurrence of the second string expression within the first specified string expression, or `-1` if the string isn't found.
18+
1719
## Syntax
18-
20+
1921
```sql
20-
INDEX_OF(<str_expr1>, <str_expr2> [, <numeric_expr>])
21-
```
22-
22+
INDEX_OF(<str_expr1>, <str_expr2> [, <numeric_expr>])
23+
```
24+
2325
## Arguments
24-
25-
*str_expr1*
26-
Is the string expression to be searched.
27-
28-
*str_expr2*
29-
Is the string expression to search for.
26+
27+
*str_expr1*
28+
Is the string expression to be searched.
29+
30+
*str_expr2*
31+
Is the string expression to search for.
3032

3133
*numeric_expr*
32-
Optional numeric expression that sets the position the search will start. The first position in *str_expr1* is 0.
33-
34+
Optional numeric expression that sets the position the search will start. The first position in *str_expr1* is 0.
35+
3436
## Return types
35-
36-
Returns a numeric expression.
37-
37+
38+
Returns a numeric expression.
39+
3840
## Examples
39-
40-
The following example returns the index of various substrings inside "abc".
41-
41+
42+
The following example returns the index of various substrings inside "abc".
43+
4244
```sql
43-
SELECT
44-
INDEX_OF("abc", "ab") AS index_of_prefix,
45-
INDEX_OF("abc", "b") AS index_of_middle,
45+
SELECT
46+
INDEX_OF("abc", "ab") AS index_of_prefix,
47+
INDEX_OF("abc", "b") AS index_of_middle,
4648
INDEX_OF("abc", "c") AS index_of_last,
4749
INDEX_OF("abc", "d") AS index_of_missing
48-
```
49-
50-
Here is the result set.
51-
50+
```
51+
52+
Here's the result set.
53+
5254
```json
5355
[
5456
{
@@ -57,8 +59,8 @@ SELECT
5759
"index_of_last": 2,
5860
"index_of_missing": -1
5961
}
60-
]
61-
```
62+
]
63+
```
6264

6365
## Next steps
6466

0 commit comments

Comments
 (0)