StringUtils.ParseBoolean method
Namespace | Skybrud.Essentials.Strings |
---|---|
Assembly | Skybrud.Essentials.dll |
ParseBoolean(string)
Parses the specified str
into an instance of bool . The string is
considered true
if it matches either true
, 1
, t
or on
(case insensitive).
public static bool ParseBoolean(string str)
Parameters
str
String
The string to be parsed.
Returns
true
if str
matches either true
, 1
, t
or on
(case insensitive).
ParseBoolean(string, bool)
Parses the specified str
into an instance of bool . The string is
considered true
if it matches either true
, 1
, t
or on
, or false
if it matches either false
, 0
, f
or off
. All comparisons are case insensitive.
public static bool ParseBoolean(string str, bool fallback)
Returns
true
if str
matches either true
, 1
, t
or on
,
false
if str
matches either false
, 0
, f
or off
. For
all other values, fallback
is returned instead.
ParseBoolean(object)
Parses the specified value
into an instance of bool . The value
is considered true
if it matches either true
, 1
, t
or on
(case insensitive).
public static bool ParseBoolean(object value)
Parameters
value
Object
The value to be parsed.
Returns
true
if value
matches either true
, 1
, t
or on
(case insensitive).
ParseBoolean(object, bool)
Parses the specified value
into an instance of bool . The string is
considered true
if it matches either true
, 1
, t
or on
, or false
if it matches either false
, 0
, f
or off
. All comparisons are case insensitive.
public static bool ParseBoolean(object value, bool fallback)
Returns
true
if value
matches either true
, 1
, t
or on
,
false
if value
matches either false
, 0
, f
or off
. For
all other values, fallback
is returned instead.