/StringUtils

Helpers for working with strings in Swift

Primary LanguageSwiftMIT LicenseMIT

StringUtils

Helpers for working with strings in Swift.

String.boolValue

Converts a String to a Bool.

The conversion is based on Apple's truthiness rules:

This property is true on encountering one of "Y", "y", "T", "t", or a digit 1-9

Examples

"YES".boolValue == true
"NO".boolValue == false

"yes".boolValue == true
"no".boolValue == false

"TRUE".boolValue == true
"FALSE".boolValue == false

"true".boolValue == true
"false".boolValue == false

"1".boolValue == true
"0".boolValue == false