Repeat a string: Difference between revisions

m
→‎{{header|Objective-C}}: Updated lang tag from c to objc.
(Add Objective-C example.)
m (→‎{{header|Objective-C}}: Updated lang tag from c to objc.)
Line 441:
We will extend NSString, the de facto Objective-C string class in environments that are either compatible with or descend directly from the OPENSTEP specification, such as GNUstep and Mac OS X, respectively, with a method that accomplishes the described task.
 
<lang cobjc>
@interface NSString (RosettaCodeAddition)
- (NSString *) repeatStringByNumberOfTimes: (NSUInteger) times;
Line 467:
Now, let's put it to use:
 
<lang cobjc>
// Instantiate an NSString by sending an NSString literal our new
// -repeatByNumberOfTimes: selector.
Line 485:
// implied by its name.
</lang>
 
=={{header|OCaml}}==
<lang ocaml>let string_repeat s n =
Anonymous user