trimEnd

@JvmName(name = "trimEndFieldReceiver")
open fun <Context : Any> Field<Context, String?>.trimEnd(): Value<Context, String?>(source)
@JvmName(name = "trimEndPropertyReceiver")
open fun <Context : Any> KProperty1<Context, String?>.trimEnd(): Value<Context, String?>(source)
@JvmName(name = "trimEndResultReceiver")
inline fun String?.trimEnd(): Value<Any, String?>(source)

Removes whitespace characters, including null, or the specified characters from the end of a string.

By default, removes whitespace characters including the null character.

Example

class Document(
val text: String,
)

collection.aggregate()
.set {
Document::text set of(Document::text).trimEnd()
}.toList()

External resources


open fun <Context : Any> Value<Context, String?>.trimEnd(vararg characters: Char): Value<Context, String?>(source)
@JvmName(name = "trimEndFieldReceiver")
open fun <Context : Any> Field<Context, String?>.trimEnd(vararg characters: Char): Value<Context, String?>(source)
@JvmName(name = "trimEndPropertyReceiver")
open fun <Context : Any> KProperty1<Context, String?>.trimEnd(vararg characters: Char): Value<Context, String?>(source)
@JvmName(name = "trimEndResultReceiver")
inline fun String?.trimEnd(vararg characters: Char): Value<Any, String?>(source)

Removes the specified characters from the end of a string.

Example

class Document(
val text: String,
)

// Trim both 'g' and 'e' characters from the end
collection.aggregate()
.set {
Document::text set of(Document::text).trimEnd('g', 'e')
}.toList()

// Trim space, 'g', and 'e' characters from the end
collection.aggregate()
.set {
Document::text set of(Document::text).trimEnd(' ', 'g', 'e')
}.toList()

External resources


@JvmName(name = "trimEndByField")
open fun <Context : Any> Value<Context, String?>.trimEnd(characters: Field<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndByProperty")
open fun <Context : Any> Value<Context, String?>.trimEnd(characters: KProperty1<Context, String?>): Value<Context, String?>(source)
inline fun <Context : Any> Value<Context, String?>.trimEnd(characters: String?): Value<Context, String?>(source)
@JvmName(name = "trimEndFieldReceiverByValue")
open fun <Context : Any> Field<Context, String?>.trimEnd(characters: Value<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndFieldReceiverByField")
open fun <Context : Any> Field<Context, String?>.trimEnd(characters: Field<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndFieldReceiverByProperty")
open fun <Context : Any> Field<Context, String?>.trimEnd(characters: KProperty1<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndFieldReceiverByResult")
inline fun <Context : Any> Field<Context, String?>.trimEnd(characters: String?): Value<Context, String?>(source)
@JvmName(name = "trimEndPropertyReceiverByValue")
open fun <Context : Any> KProperty1<Context, String?>.trimEnd(characters: Value<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndPropertyReceiverByField")
open fun <Context : Any> KProperty1<Context, String?>.trimEnd(characters: Field<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndPropertyReceiverByProperty")
open fun <Context : Any> KProperty1<Context, String?>.trimEnd(characters: KProperty1<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndPropertyReceiverByResult")
inline fun <Context : Any> KProperty1<Context, String?>.trimEnd(characters: String?): Value<Context, String?>(source)
@JvmName(name = "trimEndResultReceiverByValue")
inline fun <Context : Any> String?.trimEnd(characters: Value<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndResultReceiverByField")
inline fun <Context : Any> String?.trimEnd(characters: Field<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndResultReceiverByProperty")
inline fun <Context : Any> String?.trimEnd(characters: KProperty1<Context, String?>): Value<Context, String?>(source)
@JvmName(name = "trimEndResultReceiverByResult")
inline fun String?.trimEnd(characters: String?): Value<Any, String?>(source)

Removes the specified characters from the end of a string.

The characters parameter is a single string that can contain multiple characters to be trimmed. Each character in the string will be removed from the end of the input string.

Example

class Document(
val text: String,
)

// Trim both 'g' and 'e' characters from the end
collection.aggregate()
.set {
Document::text set of(Document::text).trimEnd(characters = of("ge"))
}.toList()

// Trim space, 'g', and 'e' characters from the end
collection.aggregate()
.set {
Document::text set of(Document::text).trimEnd(characters = of(" ge"))
}.toList()

External resources