From the course: iOS Development Tips

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

String and NSString characters

String and NSString characters

From the course: iOS Development Tips

String and NSString characters

- [Instructor] In many popular programming languages, strings are little more than an array of characters. Often referred to as C strings, since C was one of the first languages to take this approach to strings. With Unicode characters in play, this gets messed up and you have a bit more work when working with Swift with the string and NSString types. Download the exercise file, and you'll find a copy of a completed exercise file from the Unicode Character tab. Go ahead and run the code in iPhone XR simulator and we get the results from last time, which were to print doughnuts and we get a length of that, which is nine, so there are nine characters in the word doughnuts. Now, to do so, it counts the extended graphene clusters, which, for example, has this arrow here and the arrow here, so the arrows aren't counting in the character count. This makes sense if you're counting full characters, but when you start working with both string and NSString in your apps, it's one of a bunch of…

Contents