File.SetBaseName (gb)
Static Function SetBaseName ( Path As String, NewBaseName As String ) As String
Altera o nome base de um caminho, e retorna o caminho modificado.
Exemplos
DIM filePath AS String
PRINT "* Um tipo padrão de caminho"
filePath = "/my/path/file.ext"
PRINT filePath
PRINT File.SetBaseName(filePath, "novo-nome")
PRINT "\\n* Tente um caminho com duas extensões"
filePath = "/my/path/file.ext1.ext2"
PRINT filePath
PRINT File.SetBaseName(filePath, "novo-nome")
PRINT "\\n* Um caminho com apenas uma extensão"
filePath = ".ext"
PRINT filePath
PRINT File.SetBaseName(filePath, "novo-nome")
PRINT "\\n* Um caminho sem um nome de arquivo"
filePath = "/my/path/.ext"
PRINT filePath
PRINT File.SetBaseName(filePath, "novo-nome")
PRINT "\\n* Um caminho sem um nome de arquivo ou extensão"
filePath = "/my/path/"
PRINT filePath
PRINT File.SetBaseName(filePath, "novo-nome")
* Um tipo padrão de caminho
/my/path/file.ext
/my/path/new-name.ext
* Tente um caminho com duas extensões
/my/path/file.ext1.ext2
/my/path/new-name.ext2
* Um caminho com apenas uma extensão
.ext
new-name.ext
* Um caminho sem um nome de arquivo
/my/path/.ext
/my/path/new-name.ext
* Um caminho sem um nome de arquivo ou extensão
/my/path/
/my/path/new-name