Skip to content

Instantly share code, notes, and snippets.

@prat14k
Created December 20, 2017 09:55
Show Gist options
  • Save prat14k/6a407c2c4251a0d78c311f874b2457c7 to your computer and use it in GitHub Desktop.
Save prat14k/6a407c2c4251a0d78c311f874b2457c7 to your computer and use it in GitHub Desktop.
Compare string character to space or any other character
var s = "X yz"
for var i = 0; i < s.characters.count; i++ {
let x = s[s.startIndex.advancedBy(i)]
print(x)
print(String(x) == " ")
}
for c in s.characters {
print(c)
print(String(c) == " ")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment