[stdlib] Minor: fix various grammar in docs
This commit is contained in:
committed by
Space Team
parent
15375c0fd5
commit
baca742a31
@@ -73,7 +73,7 @@ public expect fun String.capitalize(): String
|
||||
public expect fun String.decapitalize(): String
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading and trailing characters matching the [predicate] removed.
|
||||
* Returns a subsequence 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
|
||||
@@ -107,7 +107,7 @@ 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] removed.
|
||||
* Returns a subsequence 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)
|
||||
@@ -124,7 +124,7 @@ 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] removed.
|
||||
* Returns a subsequence 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())
|
||||
@@ -141,7 +141,7 @@ 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 removed.
|
||||
* Returns a subsequence 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 }
|
||||
|
||||
@@ -151,7 +151,7 @@ public fun CharSequence.trim(vararg chars: Char): CharSequence = trim { it in ch
|
||||
public fun String.trim(vararg chars: Char): String = trim { it in chars }
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading characters from the [chars] array removed.
|
||||
* Returns a subsequence of this char sequence having leading characters from the [chars] array removed.
|
||||
*/
|
||||
public fun CharSequence.trimStart(vararg chars: Char): CharSequence = trimStart { it in chars }
|
||||
|
||||
@@ -161,7 +161,7 @@ public fun CharSequence.trimStart(vararg chars: Char): CharSequence = trimStart
|
||||
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 removed.
|
||||
* Returns a subsequence of this char sequence having trailing characters from the [chars] array removed.
|
||||
*/
|
||||
public fun CharSequence.trimEnd(vararg chars: Char): CharSequence = trimEnd { it in chars }
|
||||
|
||||
@@ -171,7 +171,7 @@ public fun CharSequence.trimEnd(vararg chars: Char): CharSequence = trimEnd { it
|
||||
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 removed.
|
||||
* Returns a subsequence of this char sequence having leading and trailing whitespace removed.
|
||||
*/
|
||||
public fun CharSequence.trim(): CharSequence = trim(Char::isWhitespace)
|
||||
|
||||
@@ -182,7 +182,7 @@ public fun CharSequence.trim(): CharSequence = trim(Char::isWhitespace)
|
||||
public inline fun String.trim(): String = (this as CharSequence).trim().toString()
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having leading whitespace removed.
|
||||
* Returns a subsequence of this char sequence having leading whitespace removed.
|
||||
*/
|
||||
public fun CharSequence.trimStart(): CharSequence = trimStart(Char::isWhitespace)
|
||||
|
||||
@@ -193,7 +193,7 @@ public fun CharSequence.trimStart(): CharSequence = trimStart(Char::isWhitespace
|
||||
public inline fun String.trimStart(): String = (this as CharSequence).trimStart().toString()
|
||||
|
||||
/**
|
||||
* Returns a sub sequence of this char sequence having trailing whitespace removed.
|
||||
* Returns a subsequence of this char sequence having trailing whitespace removed.
|
||||
*/
|
||||
public fun CharSequence.trimEnd(): CharSequence = trimEnd(Char::isWhitespace)
|
||||
|
||||
@@ -635,7 +635,7 @@ public fun String.removeSuffix(suffix: CharSequence): String {
|
||||
/**
|
||||
* When this char sequence starts with the given [prefix] and ends with the given [suffix],
|
||||
* returns a new char sequence having both the given [prefix] and [suffix] removed.
|
||||
* Otherwise returns a new char sequence with the same characters.
|
||||
* Otherwise, returns a new char sequence with the same characters.
|
||||
*/
|
||||
public fun CharSequence.removeSurrounding(prefix: CharSequence, suffix: CharSequence): CharSequence {
|
||||
if ((length >= prefix.length + suffix.length) && startsWith(prefix) && endsWith(suffix)) {
|
||||
@@ -647,7 +647,7 @@ public fun CharSequence.removeSurrounding(prefix: CharSequence, suffix: CharSequ
|
||||
/**
|
||||
* Removes from a string both the given [prefix] and [suffix] if and only if
|
||||
* it starts with the [prefix] and ends with the [suffix].
|
||||
* Otherwise returns this string unchanged.
|
||||
* Otherwise, returns this string unchanged.
|
||||
*/
|
||||
public fun String.removeSurrounding(prefix: CharSequence, suffix: CharSequence): String {
|
||||
if ((length >= prefix.length + suffix.length) && startsWith(prefix) && endsWith(suffix)) {
|
||||
@@ -659,14 +659,14 @@ public fun String.removeSurrounding(prefix: CharSequence, suffix: CharSequence):
|
||||
/**
|
||||
* When this char sequence starts with and ends with the given [delimiter],
|
||||
* returns a new char sequence having this [delimiter] removed both from the start and end.
|
||||
* Otherwise returns a new char sequence with the same characters.
|
||||
* Otherwise, returns a new char sequence with the same characters.
|
||||
*/
|
||||
public fun CharSequence.removeSurrounding(delimiter: CharSequence): CharSequence = removeSurrounding(delimiter, delimiter)
|
||||
|
||||
/**
|
||||
* Removes the given [delimiter] string from both the start and the end of this string
|
||||
* if and only if it starts with and ends with the [delimiter].
|
||||
* Otherwise returns this string unchanged.
|
||||
* Otherwise, returns this string unchanged.
|
||||
*/
|
||||
public fun String.removeSurrounding(delimiter: CharSequence): String = removeSurrounding(delimiter, delimiter)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user