containsCase method
Version of contains
that allows controlling case sensitivity better.
The default contains
method uses sqlite's LIKE
, which is case-
insensitive for the English alphabet only. containsCase is implemented
in Dart with better support for casing.
When caseSensitive
is false (the default), this is equivalent to the
Dart expression this.contains(substring)
, where this
is the string
value this expression evaluates to.
When caseSensitive
is true, the equivalent Dart expression would be
this.toLowerCase().contains(substring.toLowerCase())
.
Note that, while Dart has better support for an international alphabet, it can still yield unexpected results like the Turkish İ Problem
Implementation
Expression<bool?> containsCase(String substring,
{bool caseSensitive = false}) {
return FunctionCallExpression('moor_contains', [
this,
Variable<String>(substring),
if (caseSensitive) const Constant<int>(1) else const Constant<int>(0),
]);
}