question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for int IndexOf(string value, int startIndex)

See original GitHub issue

Currently

We Currently have an implementation of int IndexOf(string value) calling column.IndexOf("#") <= 1 that gets (roughly) translated into `

LOCATE('#', `j`.`column`) - 1) > 1

Implementing int IndexOf(string value, int startIndex) means we can use the form LOCATE('#',column,X)=0 for column.IndexOf("#", X) == -1. A way to currently achieve this implementation is to use Substring(1).IndexOf("#") == -1 which however results in a fairly interesting:

(LOCATE('#', SUBSTRING(`j`.`column`, 1 + 1, CHAR_LENGTH(`j`.`column`))) - 1) = -1

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
LeaFrockcommented, May 16, 2022

Wiki updated as requested. Since you’re a collaborator, you should see an Edit button on the page to allow you to edit the markdown.

Thanks for your update. I’m just a normal contributor 😄 and the edit button is hidden to me.

1reaction
rojicommented, May 16, 2022

@mguinness @lauxjpn @LeaFrock it turns out this actually was implemented for SQL Server in https://github.com/dotnet/efcore/pull/26623, for 7.0.0-preview.1. There’s a specification test for it as well, but since it was using a top-most projection, the test can client-eval and always passes regardless of whether a provider implements translation support or not. I opened https://github.com/dotnet/efcore/pull/28031 to improve the tests.

Note that SQLite and PostgreSQL do not have a function which accepts a start position parameter.

Read more comments on GitHub >

github_iconTop Results From Across the Web

String.IndexOf Method (System)
Reports the zero-based index of the first occurrence of the specified Unicode character in this string. The search starts at a specified character...
Read more >
C# | String.IndexOf( ) Method | Set - 1
IndexOf (char x, int start1) method. This method returns the zero-based index of the first occurrence of the specified character within the ...
Read more >
C# IndexOf Examples
We use IndexOf to see if a string contains a word. Usually we want to know the exact result of IndexOf. We can...
Read more >
C# - String IndexOf method with second argument equal to ...
So for the count parameter above, the value this.Length - startIndex is passed. Since startIndex is equal to the length, count will be...
Read more >
String IndexOf is missing API for char with start index and ...
The string IndexOf API is missing two methods for char that it has with string . It's currently not possible to perform an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found