Interface MqlString
- All Superinterfaces:
MqlValue
- Since:
- 4.9.0
-
Method Summary
Modifier and TypeMethodDescriptionThe result of appending theother
string to the end ofthis
string (strict concatenation).length()
The number of Unicode code points inthis
string.The number of UTF-8 encoded bytes inthis
string.Convertsthis
string to a date.Convertsthis
string to an integer.<R extends MqlValue>
RpassStringTo
(Function<? super MqlString, ? extends R> f) The result of passingthis
value to the provided function.default MqlString
substr
(int start, int length) The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.substr
(MqlInteger start, MqlInteger length) The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.default MqlString
substrBytes
(int start, int length) The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.substrBytes
(MqlInteger start, MqlInteger length) The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.<R extends MqlValue>
RswitchStringOn
(Function<Branches<MqlString>, ? extends BranchesTerminal<MqlString, ? extends R>> mapping) The result of applying the provided switch mapping tothis
value.toLower()
Convertsthis
string to lowercase.toUpper()
Convertsthis
string to uppercase.Methods inherited from interface com.mongodb.client.model.mql.MqlValue
asString, eq, equals, gt, gte, isArrayOr, isBooleanOr, isDateOr, isDocumentOr, isIntegerOr, isMapOr, isNumberOr, isStringOr, lt, lte, ne, passTo, switchOn
-
Method Details
-
toLower
MqlString toLower()Convertsthis
string to lowercase.- Returns:
- the resulting value.
-
toUpper
MqlString toUpper()Convertsthis
string to uppercase.- Returns:
- the resulting value.
-
append
The result of appending theother
string to the end ofthis
string (strict concatenation).- Parameters:
other
- the other value.- Returns:
- the resulting value.
-
length
MqlInteger length()The number of Unicode code points inthis
string.- Returns:
- the resulting value.
-
lengthBytes
MqlInteger lengthBytes()The number of UTF-8 encoded bytes inthis
string.- Returns:
- the resulting value.
-
substr
The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.Warning: the index position is in Unicode code points, not in UTF-8 encoded bytes.
- Parameters:
start
- the start index in Unicode code points.length
- the length in Unicode code points.- Returns:
- the resulting value.
-
substr
The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.Warning: the index position is in Unicode code points, not in UTF-8 encoded bytes.
- Parameters:
start
- the start index in Unicode code points.length
- the length in Unicode code points.- Returns:
- the resulting value.
-
substrBytes
The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.The index position is in UTF-8 encoded bytes, not in Unicode code points.
- Parameters:
start
- the start index in UTF-8 encoded bytes.length
- the length in UTF-8 encoded bytes.- Returns:
- the resulting value.
-
substrBytes
The substring ofthis
string, from thestart
index inclusive, and including the specifiedlength
, up to the end of the string.The index position is in UTF-8 encoded bytes, not in Unicode code points.
- Parameters:
start
- the start index in UTF-8 encoded bytes.length
- the length in UTF-8 encoded bytes.- Returns:
- the resulting value.
-
parseInteger
MqlInteger parseInteger()Convertsthis
string to an integer.This will cause an error if this string does not represent an integer.
- Returns:
- the resulting value.
- Since server release
- 4.0
-
parseDate
MqlDate parseDate()Convertsthis
string to a date.This method behaves like
parseDate(MqlString)
, with the default format, which is"%Y-%m-%dT%H:%M:%S.%LZ"
.Will cause an error if this string does not represent a valid date string (such as "2018-03-20", "2018-03-20T12:00:00Z", or "2018-03-20T12:00:00+0500").
- Returns:
- the resulting value.
- See Also:
-
parseDate
Convertsthis
string to a date, using the specifiedformat
. UTC is assumed if the timezone offset element is not specified in the format.Will cause an error if
this
string does not match the specifiedformat
. Will cause an error if an element is specified that is finer-grained than an element that is not specified, with year being coarsest (for example, minute is specified, but hour is not). Omitted finer-grained elements will be parsed to 0.- Parameters:
format
- the format.- Returns:
- the resulting value.
- See Also:
- MongoDB documentation
- Format Specifiers, UTC Offset, and Olson Timezone Identifier
- Since server release
- 4.0
-
parseDate
Convertsthis
string to a date, using the specifiedtimezone
andformat
.Will cause an error if
this
string does not match the specifiedformat
. Will cause an error if an element is specified that is finer-grained than an element that is not specified, with year being coarsest (for example, minute is specified, but hour is not). Omitted finer-grained elements will be parsed to 0. Will cause an error if the format includes an offset or timezone, even if it matches the suppliedtimezone
.- Parameters:
format
- the format.timezone
- the UTC Offset or Olson Timezone Identifier.- Returns:
- the resulting value.
- See Also:
- MongoDB documentation
- Format Specifiers, UTC Offset, and Olson Timezone Identifier
-
passStringTo
The result of passingthis
value to the provided function. Equivalent tof.apply(this)
, and allows lambdas and static, user-defined functions to use the chaining syntax.- Type Parameters:
R
- the type of the resulting value.- Parameters:
f
- the function to apply.- Returns:
- the resulting value.
- See Also:
-
switchStringOn
<R extends MqlValue> R switchStringOn(Function<Branches<MqlString>, ? extends BranchesTerminal<MqlString, ? extends R>> mapping) The result of applying the provided switch mapping tothis
value.- Type Parameters:
R
- the type of the resulting value.- Parameters:
mapping
- the switch mapping.- Returns:
- the resulting value.
- See Also:
-