Ad
  • Custom User Avatar

    That just creates a string that repeats string n times. Nothing more to it.

  • Custom User Avatar

    A more Swift name would be:

    func repeat(string: String, times count: Int) -> String
    

    or you could use a method on String

    extension String {
        func repeated(times count: Int) -> String { // implement }
    }
    
  • Custom User Avatar

    These functions are against Swift naming conventions. func repeatStr(_ string: String, _ n: Int) -> String. Global functions, the term Str, blank external labels and n as an internal label are all against Swift naming guidelines.