Swiftpack.co - mramsden/StringUtils as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mramsden.
mramsden/StringUtils 1.0.0
Helpers for working with strings in Swift
⭐️ 0
🕓 4 years ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/mramsden/StringUtils.git", from: "1.0.0")

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

GitHub

link
Stars: 0
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

v1.0.0
4 years ago

Initial version of this library. Includes a method to allow the conversion of a String to a Bool.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics