RosettaCodeData/Task/Repeat-a-string/Objective-C/repeat-a-string-1.m

10 lines
327 B
Mathematica
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
@interface NSString (RosettaCodeAddition)
- (NSString *) repeatStringByNumberOfTimes: (NSUInteger) times;
@end
@implementation NSString (RosettaCodeAddition)
- (NSString *) repeatStringByNumberOfTimes: (NSUInteger) times {
return [@"" stringByPaddingToLength:[self length]*times withString:self startingAtIndex:0];
}
@end