从参考资料中测试过:https://developer.apple.com/documentation/swift
var string = String(count: 5, repeatedValue: "a")
// string is "aaaaa"
Run Code Online (Sandbox Code Playgroud)
我收到了这个错误:
Playground执行失败:错误:: 5:14:错误:无法找到接受提供的参数的'init'的重载var string = String(count:5,repeatedValue:"a")
这实际上有用吗?