I have a string
, length may vary but I have to check if its length is less then 12 and if yes append those many zeros to it.
Like:
str = Test123
, output should beTest12300000
str = Test123456
, output should beTest12345600
Only 12 Char is allowed in string.
Tried below code but not getting generic result. There must be a better and easy way to do.
- (NSString *)formatValue:(NSString *)str forDigits:(NSString *)zeros {
return [NSString stringWithFormat:@"%@%@", str ,zeros];
}