File.SetExt (gb)
Static Function SetExt ( Path As String, NewExt As String ) As String
设置路径的文件扩展名,并返回修改后的路径。
Examples
DIM filePath AS String
PRINT "* 扩展名从mp3改为ogg"
filePath = "/my/path/file.mp3"
PRINT filePath
PRINT File.SetExt(filePath, "ogg")
PRINT "\\n* 添加扩展名"
filePath = "/my/path/file"
PRINT filePath
PRINT File.SetExt(filePath, "new")
PRINT "\\n* 改变隐含文件扩展名"
filePath = "/my/path/.file.ext"
PRINT filePath
PRINT File.SetExt(filePath, "new")
PRINT "\\n* 确定有文件名,否则"
PRINT "* 可能最终获得一个无效路径"
filePath = "/my/path/.ext"
PRINT filePath
PRINT File.SetExt(filePath, "new")
PRINT "\\n* 确定有文件名和扩展名,否则"
PRINT "* 可能最终获得一个无效路径"
filePath = "/my/path/"
PRINT filePath
PRINT File.SetExt(filePath, "new")
* 扩展名从mp3改为ogg
/my/path/file.mp3
/my/path/file.ogg
* 添加扩展名
/my/path/file
/my/path/file.new
* 改变隐含文件扩展名
/my/path/.file.ext
/my/path/.file.new
* 确定有文件名,否则
* 可能最终获得一个无效路径
/my/path/.ext
/my/path.new
* 确定有文件名和扩展名,否则
* 可能最终获得一个无效路径
/my/path/
/my/path.new