Interface MqlString
- All Superinterfaces:
MqlValue
- Since:
- 4.9.0
-
Method Summary
Modifier and TypeMethodDescriptionThe result of appending theotherstring to the end ofthisstring (strict concatenation).length()The number of Unicode code points inthisstring.The number of UTF-8 encoded bytes inthisstring.Convertsthisstring to a date.Convertsthisstring to an integer.<R extends MqlValue>
RpassStringTo(Function<? super MqlString, ? extends R> f) The result of passingthisvalue to the provided function.default MqlStringsubstr(int start, int length) The substring ofthisstring, from thestartindex inclusive, and including the specifiedlength, up to the end of the string.substr(MqlInteger start, MqlInteger length) The substring ofthisstring, from thestartindex inclusive, and including the specifiedlength, up to the end of the string.default MqlStringsubstrBytes(int start, int length) The substring ofthisstring, from thestartindex inclusive, and including the specifiedlength, up to the end of the string.substrBytes(MqlInteger start, MqlInteger length) The substring ofthisstring, from thestartindex 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 tothisvalue.toLower()Convertsthisstring to lowercase.toUpper()Convertsthisstring 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()Convertsthisstring to lowercase.- Returns:
- the resulting value.
-
toUpper
MqlString toUpper()Convertsthisstring to uppercase.- Returns:
- the resulting value.
-
append
The result of appending theotherstring to the end ofthisstring (strict concatenation).- Parameters:
other- the other value.- Returns:
- the resulting value.
-
length
MqlInteger length()The number of Unicode code points inthisstring.- Returns:
- the resulting value.
-
lengthBytes
MqlInteger lengthBytes()The number of UTF-8 encoded bytes inthisstring.- Returns:
- the resulting value.
-
substr
The substring ofthisstring, from thestartindex 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 ofthisstring, from thestartindex 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 ofthisstring, from thestartindex 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 ofthisstring, from thestartindex 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()Convertsthisstring 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()Convertsthisstring 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
Convertsthisstring 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
thisstring 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
Convertsthisstring to a date, using the specifiedtimezoneandformat.Will cause an error if
thisstring 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 passingthisvalue 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 tothisvalue.- Type Parameters:
R- the type of the resulting value.- Parameters:
mapping- the switch mapping.- Returns:
- the resulting value.
- See Also:
-