I'm trying to put a mask on a string that is a CNPJ. I get a string with size 14 and tried to put the mask in:
NSString *cnpj = [NSString stringWithFormat:@"%@.%@.%@/%@-%@",
self.codCnpj substringWithRange:NSMakeRange(11, 2)],
[self.codCnpj substringWithRange:NSMakeRange(8, 3)],
[self.codCnpj substringWithRange:NSMakeRange(5, 3)],
[self.codCnpj substringWithRange:NSMakeRange(1, 4)],
[self.codCnpj substringWithRange:NSMakeRange(0, 2)]];
Well, that is not giving a damn right .. Some values repeat themselves and others are not shown. Does anyone have any suggestions for improvement or a simpler way to do this?