Learn how to access and modify strings and arrays using arithmetic and range operators, and how to understand the difference between string and array indexes.
- [Voiceover] Certain operators are also available for…strings and arrays to combine, append, and work…with sub-ranges of.…I'm starting out with a couple strings.…I'll use the plus operator to combine…or concatenate these two strings.…It does not mutate the strings, but instead it…turns a new string, equal to the left and right strings…combined which I'll assign to a new value.…The plus equals operator can be used to append the…right side onto a variable string.…Range operators can also be used to work with…sub-strings of strings, however, unlike arrays,…string indexes are not regular integer values…but a special string index type.…
To demonstrate using a closed range operator,…first I'll create a start index and end index values…using strings index offset-by method.…Notice that for start index I passed as a parameter,…the strings start index property which returns…the position of the strings first character…and I offset by seven to get the beginning…of the word 'viewer' in the 'Hello' string.…For end index, I passed the strings end index property…
Learn how to write code, understand Swift's key concepts and best practices, and strengthen your programming problem-solving skills. Instructor Scott Gardner teaches the fundamentals, so you'll be prepared to develop applications for iOS, macOS, and other platforms. Completing this course will enable you to not only write first-class code, but to think like a Swift developer.
- Creating playgrounds
- Defining variables and constants
- Working with characters and strings
- Working with collections and groups
- Using operators and defining custom operators
- Controlling program flow
- Defining functions and closures
- Working with classes, structures, and enumerations
- Adopting protocols
Skill Level Beginner
1. Get Started
2. Variables and Constants
3. Characters and Strings
4. Collections and Tuples
6. Control Flow
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.