7 Strings
In programming, textual content is represented by strings.
You have seen and used strings already.
"Hello, playground", for example, is a string that appears at the top of every newly created playground.
Like all strings, it can be thought of as an ordered collection of characters.
In this chapter, you will see more of what strings can do.
Working with Strings
In Swift, you create strings with the String type. Create a new playground called Strings.playground and add the following new instance of the String type.
Listing 7.1 Hello, playground
let playground = "Hello, playground"
You have created a String instance named playground using the string literal syntax, which encloses a sequence of text with ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access