mirror of
https://github.com/Z3Prover/z3
synced 2025-04-27 02:45:51 +00:00
implementing last-index-of #2089
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
parent
62ec02e50f
commit
3c8fd83c97
10 changed files with 174 additions and 31 deletions
|
@ -10154,6 +10154,15 @@ def IndexOf(s, substr, offset):
|
|||
offset = IntVal(offset, ctx)
|
||||
return ArithRef(Z3_mk_seq_index(s.ctx_ref(), s.as_ast(), substr.as_ast(), offset.as_ast()), s.ctx)
|
||||
|
||||
def LastIndexOf(s, substr):
|
||||
"""Retrieve the last index of substring within a string"""
|
||||
ctx = None
|
||||
ctx = _get_ctx2(s, substr, ctx)
|
||||
s = _coerce_seq(s, ctx)
|
||||
substr = _coerce_seq(substr, ctx)
|
||||
return ArithRef(Z3_mk_seq_last_index(s.ctx_ref(), s.as_ast(), substr.as_ast()), s.ctx)
|
||||
|
||||
|
||||
def Length(s):
|
||||
"""Obtain the length of a sequence 's'
|
||||
>>> l = Length(StringVal("abc"))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue