How to create a string with a repeated character N times in Swift

1 Answer

0 votes
import Foundation

let repeated = String(repeating: "*", count: 10) // Repeats '*' 10 times

print(repeated)



/*
run:

**********

*/

 



answered Jul 28, 2025 by avibootz
...