WilhelmOks / InsensitiveString-Swift

Short syntax to compare strings ignoring case.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Usage

Prefix any string with ^ to make it case insensitive. Comparison with other strings will use Swift's localizedCaseInsensitiveCompare function under the hood:

let fileExtension = "JPG"

let message: String

switch ^fileExtension {
case "jpg":
    message = "It's a jpg!"
default:
    message = "It's not a jpg!"
}

About

Short syntax to compare strings ignoring case.

License:MIT License


Languages

Language:Swift 100.0%