StringUtils.ParseBoolean method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Strings
Assembly Skybrud.Essentials.dll

ParseBoolean(string)

Static

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)

Static

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)

Parameters

str String

The string to be parsed.

fallback bool

The fallback value.

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)

Static

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)

Static

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)

Parameters

value Object

The value to be parsed.

fallback bool

The fallback value.

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.