B4J Question FileBaseName & FileExtension

Walt

Member
FileBaseName and FileExtension, found in the jMMTools library are just what I needed.
But, I'd like to know if there are any other slick ways the get the name and extension out of a file?
 

stevel05

Expert
Licensed User
Longtime User
Try:
B4X:
    Dim FullFilePath As String = "C:/users/file.ext"
    Dim FileName As String = File.GetName(FullFilePath)
    Dim Pos As Int = FileName.LastIndexOf(".")
    Dim FileBase As String =  FileName.SubString2(0,Pos)
    Dim FileExtn As String = FileName.SubString(Pos)
    Log(FileBase)
    Log(FileExtn)
 
Upvote 0
Top