Skip to content

Instantly share code, notes, and snippets.

@Ben-G
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ben-G/ebd15c7c227eb296985c to your computer and use it in GitHub Desktop.
Save Ben-G/ebd15c7c227eb296985c to your computer and use it in GitHub Desktop.
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
let greeting: String = "hello, world!"
let capitalizedGreeting = greeting.capitalizedString
let testString = "👴🙅HahaśāGœ"
for c in testString.characters {
print(c)
}
for c in testString.cStringUsingEncoding(NSUTF16StringEncoding)! {
print(c)
}
let oldString: NSString = testString
print(oldString.length, appendNewline: false) // 12
print(testString.characters.count, appendNewline: false) // 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment