mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-9795 Add method contains in Substring, its indexOf always returns -1 if substring wasn't found
This commit is contained in:
@@ -186,7 +186,11 @@ public class Substring implements CharSequence {
|
||||
|
||||
public int indexOf(@NotNull String s) {
|
||||
int n = myString.indexOf(s, myStartOffset);
|
||||
return n < myEndOffset ? n - myStartOffset : -1;
|
||||
return n >= 0 && n < myEndOffset ? n - myStartOffset : -1;
|
||||
}
|
||||
|
||||
public boolean contains(@NotNull String s) {
|
||||
return indexOf(s) >= 0;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
Reference in New Issue
Block a user