Created
December 20, 2017 09:55
-
-
Save prat14k/6a407c2c4251a0d78c311f874b2457c7 to your computer and use it in GitHub Desktop.
Compare string character to space or any other character
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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