Swift
xxxxxxxxxx
let fileNameToDelete = "myFileName.txt"
var filePath = ""
let dirs : [String] = NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.allDomainsMask, true)
if dirs.count > 0 {
let dir = dirs[0] //documents directory
filePath = dir.appendingFormat("/" + fileNameToDelete)
print("Local path = \(filePath)")
} else {
print("Could not find local directory to store file")
return
}
do {
let fileManager = FileManager.default
if fileManager.fileExists(atPath: filePath) {
try fileManager.removeItem(atPath: filePath)
} else {
print("File does not exist")
}
}
catch let error as NSError {
print("An error took place: \(error)")
}
C - 使用动态内存分配查找最大数
Linux - 如何安装 zlib1g-dev
Kotlin - 查找数字的阶乘
Java - 创建金字塔和图案
Linux - 如何安装 anc-api-tools
Linux - 如何安装 clang-tools-4.0
Python - 如何按值对字典进行排序?
Linux - 如何安装 curvedns
Kotlin - 将两个浮点数相乘
Linux - 如何安装 elpa-git-commit
JavaScript - 计算字符串中元音的数量
C++ - 检查一个数字是否是素数
PHP - 按值升序排列的关联数组
Java - 连接两个数组
Kotlin - 获取当前日期/时间
Kotlin - 检查字符串是否为数字
Java - 反转数字
Kotlin - 计算数字的幂
We have been online since 2021 and 1 millions of people around the globe have visited our website since then
More visitors every month