mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-04-17 00:21:27 +00:00
Unify docs wording of 'trim*' functions
This commit is contained in:
@@ -25,7 +25,7 @@ import kotlin.internal.contracts.*
|
||||
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading and trailing characters matching the [predicate] trimmed.
|
||||
* Returns a sub sequence of this char sequence having leading and trailing characters matching the [predicate] removed.
|
||||
*/
|
||||
public inline fun CharSequence.trim(predicate: (Char) -> Boolean): CharSequence {
|
||||
var startIndex = 0
|
||||
@@ -54,13 +54,13 @@ public inline fun CharSequence.trim(predicate: (Char) -> Boolean): CharSequence
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with leading and trailing characters matching the [predicate] trimmed.
|
||||
* Returns a string having leading and trailing characters matching the [predicate] removed.
|
||||
*/
|
||||
public inline fun String.trim(predicate: (Char) -> Boolean): String
|
||||
= (this as CharSequence).trim(predicate).toString()
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading characters matching the [predicate] trimmed.
|
||||
* Returns a sub sequence of this char sequence having leading characters matching the [predicate] removed.
|
||||
*/
|
||||
public inline fun CharSequence.trimStart(predicate: (Char) -> Boolean): CharSequence {
|
||||
for (index in this.indices)
|
||||
@@ -71,13 +71,13 @@ public inline fun CharSequence.trimStart(predicate: (Char) -> Boolean): CharSequ
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with leading characters matching the [predicate] trimmed.
|
||||
* Returns a string having leading characters matching the [predicate] removed.
|
||||
*/
|
||||
public inline fun String.trimStart(predicate: (Char) -> Boolean): String
|
||||
= (this as CharSequence).trimStart(predicate).toString()
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having trailing characters matching the [predicate] trimmed.
|
||||
* Returns a sub sequence of this char sequence having trailing characters matching the [predicate] removed.
|
||||
*/
|
||||
public inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequence {
|
||||
for (index in this.indices.reversed())
|
||||
@@ -88,48 +88,48 @@ public inline fun CharSequence.trimEnd(predicate: (Char) -> Boolean): CharSequen
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string with trailing characters matching the [predicate] trimmed.
|
||||
* Returns a string having trailing characters matching the [predicate] removed.
|
||||
*/
|
||||
public inline fun String.trimEnd(predicate: (Char) -> Boolean): String
|
||||
= (this as CharSequence).trimEnd(predicate).toString()
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading and trailing characters from the [chars] array trimmed.
|
||||
* Returns a sub sequence of this char sequence having leading and trailing characters from the [chars] array removed.
|
||||
*/
|
||||
public fun CharSequence.trim(vararg chars: Char): CharSequence = trim { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a string with leading and trailing characters from the [chars] array trimmed.
|
||||
* Returns a string having leading and trailing characters from the [chars] array removed.
|
||||
*/
|
||||
public fun String.trim(vararg chars: Char): String = trim { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading and trailing characters from the [chars] array trimmed.
|
||||
* Returns a sub sequence of this char sequence having leading characters from the [chars] array removed.
|
||||
*/
|
||||
public fun CharSequence.trimStart(vararg chars: Char): CharSequence = trimStart { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a string with leading and trailing characters from the [chars] array trimmed.
|
||||
* Returns a string having leading characters from the [chars] array removed.
|
||||
*/
|
||||
public fun String.trimStart(vararg chars: Char): String = trimStart { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having trailing characters from the [chars] array trimmed.
|
||||
* Returns a sub sequence of this char sequence having trailing characters from the [chars] array removed.
|
||||
*/
|
||||
public fun CharSequence.trimEnd(vararg chars: Char): CharSequence = trimEnd { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a string with trailing characters from the [chars] array trimmed.
|
||||
* Returns a string having trailing characters from the [chars] array removed.
|
||||
*/
|
||||
public fun String.trimEnd(vararg chars: Char): String = trimEnd { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading and trailing whitespace trimmed.
|
||||
* Returns a sub sequence of this char sequence having leading and trailing whitespace removed.
|
||||
*/
|
||||
public fun CharSequence.trim(): CharSequence = trim(Char::isWhitespace)
|
||||
|
||||
/**
|
||||
* Returns a string with leading and trailing whitespace trimmed.
|
||||
* Returns a string having leading and trailing whitespace removed.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun String.trim(): String = (this as CharSequence).trim().toString()
|
||||
@@ -140,7 +140,7 @@ public inline fun String.trim(): String = (this as CharSequence).trim().toString
|
||||
public fun CharSequence.trimStart(): CharSequence = trimStart(Char::isWhitespace)
|
||||
|
||||
/**
|
||||
* Returns a string with leading whitespace removed.
|
||||
* Returns a string having leading whitespace removed.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun String.trimStart(): String = (this as CharSequence).trimStart().toString()
|
||||
@@ -151,7 +151,7 @@ public inline fun String.trimStart(): String = (this as CharSequence).trimStart(
|
||||
public fun CharSequence.trimEnd(): CharSequence = trimEnd(Char::isWhitespace)
|
||||
|
||||
/**
|
||||
* Returns a string with trailing whitespace removed.
|
||||
* Returns a string having trailing whitespace removed.
|
||||
*/
|
||||
@kotlin.internal.InlineOnly
|
||||
public inline fun String.trimEnd(): String = (this as CharSequence).trimEnd().toString()
|
||||
|
||||
Reference in New Issue
Block a user