[swift-evolution] Add conversion String -> Bool

Arsen Gasparyan to.arsen.gasparyan at gmail.com
Sat Jun 4 08:10:22 CDT 2016


Hello,

It would be great if we had `init?(_ text: String)` for Bool class. Because
sometime when you're processing JSON/XML it can help you a lot.

Examples:

Bool("true") -> true
Bool("false") -> false
Bool("TrUE") -> true
Bool(" true ") -> nil
Bool("1") -> nil
Bool("Y") -> nil
Bool("whatever") -> nil



via https://bugs.swift.org/browse/SR-1282

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160604/1667ef27/attachment.html>


More information about the swift-evolution mailing list