I have tried to print it but it just by passes because it's an escaped character. e.g output should be as follows.
\correct
Thanks in advance
I have tried to print it but it just by passes because it's an escaped character. e.g output should be as follows.
\correct
Thanks in advance
For that and also future reference:
It will print I love my "country"
Use the following code for Swift 5, Xcode 10.2
Output:
Now not required to add a double slash to use a single slash in swift 5, even now required slash before some character, for example, single quote, double quote etc.
See this post for latest update about swift 5
https://www.hackingwithswift.com/articles/126/whats-new-in-swift-5-0
The backslash character
\
acts as an escape character when used in a string. This means you can use, for example, double quotes, in a string by pre-pending them with\
. The same also applies for the backslash character itself, which is to say thatprintln("\\")
will result in just\
being printed.