Anonymous user
Repeat a string: Difference between revisions
→{{header|Swift}}
(→{{header|OCaml}}: Bytes instead of String) |
|||
Line 1,487:
// Slower version
func repeatString(n: Int) -> String {
return
}
// Faster version
// benchmarked with a 1000 characters and 100 repeats the fast version is approx 500 000 times faster :-)
func
var result = self
for _ in 1 ..< n {
result.
}
return result
Line 1,501:
}
{{out}}
<pre>
hahahahaha
|