toBoolean

Platform and version requirements: JVM (1.0), JS (1.0), Native (1.0)
@DeprecatedSinceKotlin("1.4") fun String.toBoolean(): Boolean
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.

Platform and version requirements: JS (1.4), Native (1.4)
fun String?.toBoolean(): Boolean
Platform and version requirements: JVM (1.4)
@JvmName("toBooleanNullable") fun String?.toBoolean(): Boolean
For Common, JS, Native

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.

For JVM

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.

© 2010–2021 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/to-boolean.html