fromString

Summary

Converts a string to a bool value.

Usage

public static bool fromString(string boolAsStr)

Returns

The bool equivalent of the string value or false if the string is not a Boolean value.

Parameters

boolAsStr

The string value to convert.

Description

Converts a string to a bool value.

import System;

bool b = Boolean.fromString("true");
Console.log(b); // 100

If the string being converted is not a valid Boolean value, false is returned.

import System;

bool b = Boolean.fromString("abc");
Console.log(b); // false

Examples

Basic Usage
1
2
3
4
import System;
 
bool b = Boolean.fromString("false");
Console.log(b); // false

Share

HTML | BBCode | Direct Link