toBoolean

Common
JVM
JS
Native
1.0
@DeprecatedSinceKotlin("1.4") fun String.toBoolean(): Boolean
(Common source) (JVM source) (JS source) (Native source)
Deprecated: Use Kotlin compiler 1.4 to avoid deprecation warning.

Returns true if the content of this string is equal to the word "true", ignoring case, and false otherwise.

Common
JS
Native
1.4
fun String?.toBoolean(): Boolean
(Common source) (JS source) (Native source)
JVM
1.4
@JvmName("toBooleanNullable") fun String?.toBoolean(): Boolean
(source)

Returns true if this string is not null and its content is equal to the word "true", ignoring case, and false otherwise.

There are also strict versions of the function available on non-nullable String, toBooleanStrict and toBooleanStrictOrNull.