Skip to content

Commit

Permalink
Made indexOf and lastIndexOf return -1 when not found
Browse files Browse the repository at this point in the history
  • Loading branch information
stroomdev66 committed Apr 12, 2024
1 parent 7ef8d8c commit 85be063
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions content/en/docs/user-guide/dashboards/expressions/string.md
Expand Up @@ -23,6 +23,22 @@ concat('this ', 'is ', 'how ', 'it ', 'works')
> 'this is how it works'
```

## Contains

Tests if inputString contains subString.

```clike
contains(inputString, subString)
```

Example

```clike
contains('this', 'this')
> true
contains('this', 'that')
> false
```

## Current User

Expand Down Expand Up @@ -164,10 +180,10 @@ include('bye', 'hello', 'hi')

## Index Of

Finds the first position of the second string within the first
Finds the first position (zero based) of subString in inputString or `-1` if it cannot be found. Uses a simple literal match.

```clike
indexOf(firstString, secondString)
indexOf(inputString, subString)
```

Example
Expand All @@ -179,10 +195,10 @@ indexOf('aa-bb-cc', '-')

## Last Index Of

Finds the last position of the second string within the first
Finds the last position (zero based) of subString in inputString or `-1` if it cannot be found. Uses a simple literal match.

```clike
lastIndexOf(firstString, secondString)
lastIndexOf(inputString, subString)
```

Example
Expand Down

0 comments on commit 85be063

Please sign in to comment.