ios - Uniquely mapping upper case to lower case -
i have 2 strings:
ahfkzxz-chv6emxlzmxvd2rldnizcxiluhv6emxlsw1hz2uygicagicagibcda ahfkzxz-chv6emxlzmxvd2rldnizcxiluhv6emxlsw1hz2uygicagicagibcda
you'll notice these 2 strings identical, other 3rd-to-last letter 'c' being upper-case in one, , lower-case in other. saving files disk based on these names - problem becomes, since mac os x case-insensitive file system, 2nd file name overwrite first.
my immediate thought iterate on letters in string, , 'map' upper-case letters lower case. instance, every upper case letter, replace 2 lower case letters ('c' become 'cc').
is there problem uniqueness in implementation? simplest way accomplish in objective c? iterating on each letter easy enough, curious if there built-in helper functions might make less painless.
also not sure file name length limitations on mac osx/ios.
*also note ios app, want solve because bugs out in simulator.
you doing wrong.
possible solution:
- convert string uppercase/lowercase
- if both "keys" valid , need 2 distinct files them, don't use key file name. assign unique (e.g. incrementing) file name , have separate file mapping key file name.
Comments
Post a Comment