title: How to avoid duplicate entries in Array with case sensitive and case insensitive mixed Strings in Swift?
body: <p>I have a tableview that displays a list of objects of type String, using Core Data, where the user can keep adding new objects to that same table. There´s one limitation, though, which is not allow to add duplicates. I managed to avoid duplicates that are the same for example: "Bank"/"Bank". Problem is I also need to block duplicates like this: "Bank"/"bAnk" or "Bank"/"BAnk" and so on, but I have no idea of how to do this.</p>
  
  <p>Here is my code:</p>
  
  <pre><code> func checkDuplicates(catName: String) -&gt; Bool {
      let appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
      let managedContext = appDelegate.managedObjectContext
      var contents = [NSManagedObject]()
      var items = [String]()
      let fetchRequest = NSFetchRequest(entityName: "Categories")
      do {
          let results = try managedContext.executeFetchRequest(fetchRequest)
          contents = results as! [Items]
          for item in contents {
              items.append(item.valueForKey("name") as! String)
          }
      } catch {
          print("error")
      }
  
      if items.contains(catName) {
          return true
      }
      return false
  }
  </code></pre>
  
  <p>It returns a Bool so that when it returns a duplicate I display an Alert telling the user he can add a duplicate.</p>
  
  <p>So anyone can help my with this?</p>