"Testing1"
Swift Strings
Swift Strings (Text Storage)
In Swift, Strings are used to store words, letters, or full sentences. Think of them as a container for readable text.
Declaring a String
Wrap your text inside double quotes to craft a string in Swift.
let greeting = "Hello, Swift!"
Here, greeting holds a sequence of characters.
Common String Actions
Join strings:
let first = "Hello" let second = "World" Let combined = first + " " + second // "Hello World"
Insert value inside:
let name = "Alex" Let message = "Hi, \(name)!" // "Hi, Alex!"
Check length:
let word = "Swift" Print(word.count) // 5
Uppercase / Lowercase:
print(word.uppercased()) // "SWIFT" Print(word.lowercased()) // "swift"
Why Strings Matter
- Used for labels, messages, user input, and more.
- Easy to build, edit, and analyze.
Prefer Learning by Watching?
Watch these YouTube tutorials to understand GIT Tutorial visually:
What You'll Learn:
- 📌 Swift Strings Explained: A Crash Course for Beginners
- 📌 Swift for Beginners Part 14 - Strings tutorial (2020)