Does Swift init(count:, repeatedValue:) work?

前端 未结 6 2386
暗喜
暗喜 2021-02-18 15:04

Tested this from the reference: https://developer.apple.com/documentation/swift

var string = String(count: 5, repeatedValue: \"a\")
// string is \"aaaaa\"
         


        
6条回答
  •  鱼传尺愫
    2021-02-18 15:40

    This works just fine :

    var str9 = String(count: 5,repeatedValue: Character("c"))
    

提交回复
热议问题