toBool
Converte um valor de argumento em um valor booleano, dependendo de seu tipo.
- Da string: tente converter o valor da string como um booleano, de "true" se o valor da string for "true", caso contrário, false
- De numérico: true se o valor numérico não for igual a 0, false caso contrário
Categoria
Conversão
Sintaxe da função
toBool(<parameter>)
Parâmetros
- decimal
- booleano
- string
- integer
Assinaturas e tipos retornados
toBool(<decimal>)
toBool(<boolean>)
toBool(<string>)
toBool(<integer>)
Retorne um booleano.
Exemplos
toBool("true")
toBool(1)
Retorna true.
toBool("this is not a boolean")
Retorna false.