Skip to content

Commit

Permalink
Add support for IndexOf with index and StringComparison
Browse files Browse the repository at this point in the history
  • Loading branch information
nojaf committed Nov 29, 2023
1 parent d0f600e commit 7a9d703
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Fable.Transforms/Replacements.fs
Original file line number Diff line number Diff line change
Expand Up @@ -2550,6 +2550,7 @@ let strings
| [ ExprType String ]
| [ ExprType Char; ExprType(Number(Int32, NumberInfo.Empty)) ]
| [ ExprType String; ExprType(Number(Int32, NumberInfo.Empty)) ]
| [ ExprType String; StringComparisonEnumValue ]
| [ ExprType String
ExprType(Number(Int32, NumberInfo.Empty))
StringComparisonEnumValue ] ->
Expand Down
8 changes: 8 additions & 0 deletions tests/Js/Main/StringTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,10 @@ let tests =
|> equal 4
testCase "String.IndexOf with StringComparison" <| fun () ->
"abcdbc".IndexOf("b", StringComparison.Ordinal)
|> equal 1
testCase "String.IndexOf with index and StringComparison" <| fun () ->
"abcdbc".IndexOf("b", 3, StringComparison.Ordinal)
|> equal 4
Expand All @@ -732,6 +736,10 @@ let tests =
|> equal 1
testCase "String.LastIndexOf with StringComparison" <| fun () ->
"abcdbc".LastIndexOf("b", StringComparison.Ordinal)
|> equal 4
testCase "String.LastIndexOf with index and StringComparison" <| fun () ->
"abcdbc".LastIndexOf("b", 3, StringComparison.Ordinal)
|> equal 1
Expand Down

0 comments on commit 7a9d703

Please sign in to comment.