Module smt_strings

Module smt_strings 

Source
Expand description

Basic string representation and operations for the SMT-LIB theory of strings

In SMT-LIB, a string is a sequence of integers in the range 0x00000 .. 0x2FFFF (inclusive). This is enough to encode Unicode characters but can also include non Unicode characters.

This module provide functions for constructing SMT string constants. It also implements all operations on strings defined by the SMT-LIB standard.

We limit the length of string constants to i32::MAX and the code will panic if this bound is exceeded.

Structs§

SmtString
Internal representation of an SMT string

Constants§

EMPTY
The empty string
MAX_CHAR
Maximal character index
MAX_LENGTH
Maximal length of a string
REPLACEMENT_CHAR
Replacement for an integer not in the range [0…0x2FFFF]

Functions§

char_to_smt
Convert integer x (interpreted as a Unicode codepoint) to a string in the SMT syntax:
good_char
Check whether an integer is a valid SMT character
good_string
Check whether all elements in a slice are valid SMT characters
parse_smt_literal
Parse a string literal in the SMT-LIB syntax and convert it to an SmtString.
smt_char_as_string
Convert an SMT character to a string literal
str_at
Character at index i in s, converted to a single-character string
str_concat
Concatenate two strings
str_contains
Check whether s2 is a substring of s1
str_from_code
Single-character string with character code x
str_from_int
Convert x to a string
str_indexof
Index of the first occurrence of s2 in s1, starting from index i
str_is_digit
Check whether s contains a single digit between ‘0’ and ‘9’
str_le
Lexicographic comparison.
str_len
String length
str_lt
Strict lexicographic comparison.
str_prefixof
Check whether s1 is a prefix of s2
str_replace
Replace the first occurrence of p in s with r.
str_replace_all
Replace all occurrences of p in s with r.
str_substr
Substring of s that starts at index i and has length at most n
str_suffixof
Check whether s1 is a suffix of s2
str_to_code
Code for s if s is a single-character string, -1 otherwise
str_to_int
Convert s to an integer