September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
26
Task/Literals-String/Kotlin/literals-string.kotlin
Normal file
26
Task/Literals-String/Kotlin/literals-string.kotlin
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// version 1.0.6
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val cl = 'a' // character literal - can contain escaped character
|
||||
val esl = "abc\ndef" // escaped string literal - can contain escaped character(s)
|
||||
val rsl = """
|
||||
This is a raw string literal
|
||||
which does not treat escaped characters
|
||||
(\t, \b, \n, \r, \', \", \\, \$ and \u)
|
||||
specially and can contain new lines.
|
||||
|
||||
"Quotes" or doubled ""quotes"" can
|
||||
be included without problem but not
|
||||
tripled quotes.
|
||||
"""
|
||||
val msl = """
|
||||
|Leading whitespace can be removed from a raw
|
||||
|string literal by including
|
||||
|a margin prefix ('|' is the default)
|
||||
|in combination with the trimMargin function.
|
||||
""".trimMargin()
|
||||
println(cl)
|
||||
println(esl)
|
||||
println(rsl)
|
||||
println(msl)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue