X-Git-Url: https://git.yukkurigames.com/?p=enjoyable.git;a=blobdiff_plain;f=Categories%2FNSString%2BFixFilename.h;fp=Categories%2FNSString%2BFixFilename.h;h=b3e318f0b3bbf2fec066b8fb0a24c6be57da7d2c;hp=0000000000000000000000000000000000000000;hb=0064c1fbff36795885a9724081af2a17d83c20a3;hpb=56d825ba259066d847a9fc3f9c8c0c0a362a1507 diff --git a/Categories/NSString+FixFilename.h b/Categories/NSString+FixFilename.h new file mode 100644 index 0000000..b3e318f --- /dev/null +++ b/Categories/NSString+FixFilename.h @@ -0,0 +1,28 @@ +// +// NSString+FixFilename.h +// Enjoyable +// +// Created by Joe Wreschnig on 3/7/13. +// +// + +#import + +@interface NSCharacterSet (FixFilename) + ++ (NSCharacterSet *)invalidPathComponentCharacterSet; + // A character set containing the characters that are invalid to + // use in path components on common filesystems. + +@end + +@interface NSString (FixFilename) + +- (NSString *)stringByFixingPathComponent; + // Does various operations to make this string suitable for use as + // a single path component of a normal filename. Removes + // characters that are invalid. Strips whitespace from the + // beginning and end. If the first character is a . or a -, a _ is + // added to the front. + +@end