String.toBoolean() should be String?.toBoolean() #KT-14119

This commit is contained in:
Abduqodiri Qurbonzoda
2020-02-27 21:08:31 +03:00
parent b8b1dd753c
commit d5c851980c
8 changed files with 38 additions and 16 deletions
@@ -46,10 +46,12 @@ public actual inline fun Int.toString(radix: Int): String = java.lang.Integer.to
public actual inline fun Long.toString(radix: Int): String = java.lang.Long.toString(this, checkRadix(radix))
/**
* Returns `true` if the contents of this string is equal to the word "true", ignoring case, and `false` otherwise.
* Returns `true` if this string is not `null` and its content is equal to the word "true", ignoring case, and `false` otherwise.
*/
@JvmName("toBooleanNullable")
@SinceKotlin("1.4")
@kotlin.internal.InlineOnly
public actual inline fun String.toBoolean(): Boolean = java.lang.Boolean.parseBoolean(this)
public actual inline fun String?.toBoolean(): Boolean = java.lang.Boolean.parseBoolean(this)
/**
* Parses the string as a signed [Byte] number and returns the result.