Can you use string/character literals within Swift string interpolation?

前端 未结 2 1513
闹比i
闹比i 2021-02-13 23:51

Is it possible to use a String/Character literal within string interpolation in Swift?

The language reference says:

The expression you write insid

相关标签:
2条回答
  • 2021-02-14 00:26

    I hope it's:

    let strfunc = repeat("H",20) as string
    println( "Output: \(strfunc)" );
    
    0 讨论(0)
  • 2021-02-14 00:49

    It can be done starting in Swift 2.1: http://www.russbishop.net/swift-2-1

    Prior to that, it wasn't possible.

    0 讨论(0)
提交回复
热议问题