Uploaded image for project: 'Swift'
  1. Swift
  2. SR-1282

Add conversion String -> Bool

    XMLWordPrintable

    Details

      Description

      Please add a conversion from String to Bool.

      init?(_ text: String)
      

      The conversion method should be case insensitive.

      Examples:

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

      This would be useful for JSON/XML processing.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            sdavids Sebastian Davids
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: