3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-23 17:15:31 +00:00
ensure that semantics of last-indexof(t,"") = len(t)
This commit is contained in:
Nikolaj Bjorner 2023-02-19 14:02:37 -08:00
parent 0758c93086
commit 755b517001
2 changed files with 3 additions and 4 deletions

View file

@ -214,8 +214,7 @@ int zstring::indexofu(zstring const& other, unsigned offset) const {
}
int zstring::last_indexof(zstring const& other) const {
if (length() == 0 && other.length() == 0) return 0;
if (other.length() == 0) return -1;
if (other.length() == 0) return length();
if (other.length() > length()) return -1;
for (unsigned last = length() - other.length() + 1; last-- > 0; ) {
bool suffix = true;