Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 mac os x 和 cocoa 的新手。我有一个 NSString 并希望确保其中的字符不是无效的,因此当我使用 NSString 创建文件夹名称时,它应该被创建并且不会因为无效字符而失败。或者可可中是否有库函数可以帮助解决这种情况?
在 unixy 系统上,文件名中唯一不允许使用的字符是'/'和'\0'。Mac 通常有 HFS+ 文件系统,所以我也会远离':'.
'/'
'\0'
':'
还有很多其他角色是完全可以接受的,但会让你哭泣和咬牙切齿,因此将一组“合理”角色列入白名单可能是更好的方法。