capitalize/decapitalize docs in stdlib/js

This commit is contained in:
Ilya Gorbunov
2018-10-21 21:21:31 +03:00
parent a1c0c679ee
commit 63c5e18149
@@ -67,18 +67,20 @@ public actual fun CharSequence.regionMatches(thisOffset: Int, other: CharSequenc
/**
* Returns a copy of this string capitalised if it is not empty or already starting with an uppper case letter, otherwise returns this
* Returns a copy of this string having its first letter uppercased, or the original string,
* if it's empty or already starts with an upper case letter.
*
* @includeFunctionBody ../../test/StringTest.kt capitalize
* @sample samples.text.Strings.capitalize
*/
public actual fun String.capitalize(): String {
return if (isNotEmpty()) substring(0, 1).toUpperCase() + substring(1) else this
}
/**
* Returns a copy of this string with the first letter lower case if it is not empty or already starting with a lower case letter, otherwise returns this
* Returns a copy of this string having its first letter lowercased, or the original string,
* if it's empty or already starts with a lower case letter.
*
* @includeFunctionBody ../../test/StringTest.kt decapitalize
* @sample samples.text.Strings.decapitalize
*/
public actual fun String.decapitalize(): String {
return if (isNotEmpty()) substring(0, 1).toLowerCase() + substring(1) else this