How to create a multiline string in Swift
In this post we will give you information about How to create a multiline string in Swift. Hear we will give you detail about How to create a multiline string in SwiftAnd how to use it also give you demo for it if it is necessary.
we are going to learn about how to make a multiline string in Swiftlanguage.
Creating a multiline string
To create a multiline string literal, we can use the three double quotation marks “”” syntax in Swift.
Here is an example:
let multilineString = """Hello you canwrite heremultiple lines"""print(multilineString)
Output:
Hello you canwrite heremultiple lines
The multiline string starts after the opening quotation marks “”” and ends on the line before closing quotation marks “””.
We can also format the final string by removing the line breaks, using the backslash () at the end of those lines.
Example:
let multilineString = """Hello you can write here multiple linesThanks"""print(multilineString)
Output:
Hello you can write here multiple linesThanks
Hope this code and post will helped you for implement How to create a multiline string in Swift. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs