3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-06-13 01:16:15 +00:00
This commit is contained in:
Nikolaj Bjorner 2022-01-12 13:28:15 -08:00
parent 0720998bac
commit dfe2b27f9a
4 changed files with 34 additions and 0 deletions

View file

@ -10961,6 +10961,18 @@ def IntToStr(s):
return SeqRef(Z3_mk_int_to_str(s.ctx_ref(), s.as_ast()), s.ctx)
def StrToCode(s):
"""Convert a unit length string to integer code"""
if not is_expr(s):
s = _py2expr(s)
return ArithRef(Z3_mk_string_to_code(s.ctx_ref(), s.as_ast()), s.ctx)
def StrFromCode(c):
"""Convert code to a string"""
if not is_expr(c):
c = _py2expr(c)
return SeqRef(Z3_mk_string_from_code(c.ctx_ref(), c.as_ast()), c.ctx)
def Re(s, ctx=None):
"""The regular expression that accepts sequence 's'
>>> s1 = Re("ab")