You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When searching for a literal in a string, we'd prefer to use String#indexOf, as it's implemented using Hotspot intrinsics, which ought to outperform anything we can write by hand.
Sadly, String#indexOf supports searching through the entire string, or searching through a suffix of the String, but does not seem to support searching from indices [m,n] where 0 < m < n < stringlength. This means that we can sometimes use these methods, but not always. Additionally, we may have to have separate code paths or runtime checks whether we're searching in a substring or the entire string.
The text was updated successfully, but these errors were encountered:
When searching for a literal in a string, we'd prefer to use String#indexOf, as it's implemented using Hotspot intrinsics, which ought to outperform anything we can write by hand.
Sadly, String#indexOf supports searching through the entire string, or searching through a suffix of the String, but does not seem to support searching from indices [m,n] where 0 < m < n < stringlength. This means that we can sometimes use these methods, but not always. Additionally, we may have to have separate code paths or runtime checks whether we're searching in a substring or the entire string.
The text was updated successfully, but these errors were encountered: