Skip to content

Commit eb068cc

Browse files
committed
Syntactic sugar for suffixOf, prefixOf, contains operations
1 parent ee0ff54 commit eb068cc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

ksmt-core/src/main/kotlin/io/ksmt/KContext.kt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2013,6 +2013,11 @@ open class KContext(
20132013
KSuffixOfExpr(this, arg0, arg1)
20142014
}
20152015

2016+
/**
2017+
* Check if first string is a suffix of second.
2018+
* */
2019+
infix fun KExpr<KStringSort>.isSuffixOf(other: KExpr<KStringSort>) = mkSuffixOf(this, other)
2020+
20162021
private val prefixOfExprCache = mkAstInterner<KPrefixOfExpr>()
20172022

20182023
/**
@@ -2030,6 +2035,11 @@ open class KContext(
20302035
KPrefixOfExpr(this, arg0, arg1)
20312036
}
20322037

2038+
/**
2039+
* Check if first string is a prefix of second.
2040+
* */
2041+
infix fun KExpr<KStringSort>.isPrefixOf(other: KExpr<KStringSort>) = mkPrefixOf(this, other)
2042+
20332043
private val stringLtCache = mkAstInterner<KStringLtExpr>()
20342044

20352045
/**
@@ -2139,6 +2149,11 @@ open class KContext(
21392149
KStringContainsExpr(this, lhs, rhs)
21402150
}
21412151

2152+
/**
2153+
* Check if first string contains second one.
2154+
* */
2155+
infix fun KExpr<KStringSort>.contains(other: KExpr<KStringSort>) = mkStringContains(this, other)
2156+
21422157
private val stringToRegexExprCache = mkAstInterner<KStringToRegexExpr>()
21432158

21442159
/**

0 commit comments

Comments
 (0)