I have several directories of 12 .caf files and am loading them programmatically:
NSString *soundToPlay = [NSString stringWithFormat:@"sounds/%d/%d_%d.caf", type, note, timbre];
If I want to, say, increment from 9 to 10 in one of those values, suddenly my string is an extra character long, which makes it harder to manipulate later with something like NSMakeRange. I’d like to keep all these %ds to a single character.
What I’d like to do is name my files using the digits 0-9 but then continue with A, B, C instead of 10, 11, 12. This would keep everything single-character. I’m hoping there’s an easy way to do this kind of thing, still allowing stuff like increment, +/-, and modulo. If so, what is it?
Xis the hexadecimal format specifier:Alternatively you could always use two digit numbers. That would allow to select from more than 16 cases: