去掉字符串中不能作为文件名的特殊…

来源:互联网 发布:批处理图片的软件 编辑:程序博客网 时间:2024/05/21 18:36

- (NSString*)useAsFileName            // add by shjborage Apr 18, 2012
{
    NSString*strTmp = self;
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"/"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"\\"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@":"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"*"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"?"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"\""withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"<"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@">"withString:@" "];
    strTmp =[strTmpstringByReplacingOccurrencesOfString:@"|"withString:@" "];
    returnstrTmp;
}

0 0
原创粉丝点击