let singleLineString = "These are the same."
OUTPUT-
"These are the same."
If you want multi-line strings you need slightly different syntax: start and end with three double quote marks, like this-
let multilineString = """ These are the same. but its not show space. """
OUTPUT-
"These are the same.\nbut its not show space."
If you only want multi-line strings to format your code neatly, and you don’t want those line breaks to actually be in your string, end each line with a \, like this-
let multilineString2 = """ These are the same. \ but its show space. """
OUTPUT-
"These are the same. but its not show space."
Thanks for reading!!
Similar solutions you may also like...
- How to convert an APNS token to String from Data
- Class Extension VS. Subclassing in Swift?
- Getters and Setters in swift | How to work willSet and didiSet? | Stored property | Computed property | Property Observers
- Swift Tutorial : Don't forget the heart of Swift Structures and Enumerations With Examples
- Swift Error Handling Best Practices With Xcode Example
- Swift Tutorial : Is Swift Object- Oriented Programming?
- How to convert an APNS token to String from Data in swift
0 Comments