Advertisement
Guest User

Untitled

a guest
Nov 17th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Swift 0.71 KB | None | 0 0
  1.  
  2. import Foundation
  3. import UIKit
  4.  
  5.  
  6. var word = ""
  7.  
  8. var subStringRepeat = false
  9.  
  10. word = "repeat"
  11.  
  12. subStringRepeat = word.range(of: "repeat", options: .caseInsensitive) != nil ||
  13.     word.range(of: "reoccurring", options: .caseInsensitive) != nil
  14.  
  15. print(#line, word, ":", subStringRepeat)
  16.  
  17. word = "rePeating"
  18.  
  19. subStringRepeat = word.range(of: "repeat", options: .caseInsensitive) != nil ||
  20.     word.range(of: "reoccurring", options: .caseInsensitive) != nil
  21.  
  22. print(#line, word, ":", subStringRepeat)
  23.  
  24. word = "reoccurring"
  25.  
  26. subStringRepeat = word.range(of: "repeat", options: .caseInsensitive) != nil ||
  27.     word.range(of: "reoccurring", options: .caseInsensitive) != nil
  28.  
  29. print(#line, word, ":", subStringRepeat)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement