美文网首页iOS学习录
URL Path 后缀名

URL Path 后缀名

作者: superlaing | 来源:发表于2017-08-31 16:12 被阅读15次
    NSString对象调用pathExtension属性,即可获得后缀名。

    <NSPathUtilities.h>
    @property (readonly, copy) NSString *pathExtension;


    例如:

    NSString *suffix = [sourceString.pathExtension lowercaseString];
    if ([suffix isEqualToString:@"png"] ||
        [suffix isEqualToString:@"jpg"] ||
        [suffix isEqualToString:@"gif"] ||
        [suffix isEqualToString:@"mp4"] ||
        [suffix isEqualToString:@"mov"] ||
        [suffix isEqualToString:@"com"] ||
        [suffix isEqualToString:@"html"] ) {
          [self doSomething];
        }
    

    相关文章

      网友评论

        本文标题:URL Path 后缀名

        本文链接:https://www.haomeiwen.com/subject/xvbqjxtx.html