【问题标题】:How can I get file tile(name) from file full path in VB6?如何从 VB6 中的文件完整路径获取文件平铺(名称)?
【发布时间】:2016-08-24 02:51:38
【问题描述】:

我想获取文件标题(只有文件名和扩展名)我怎样才能得到这个?

例如:ftp://111.111.111.111:3333/file/file01.bmp

我只想在 VB6 中获取“file01.bmp”

【问题讨论】:

标签: vb6


【解决方案1】:

我相信问题是针对 VB6,而不是针对 VB.Net 或 C#。 请包括参考“Microsoft Scripting Runtime”。

Dim fso As New FileSystemObject
Dim filename As String

filename = fso.GetFileName("ftp://111.111.111.111:3333/file/file01.bmp")

【讨论】:

    【解决方案2】:

    你可以使用Path.GetFileName

    var filename = Path.GetFileName(filepath);
    

    在 VB.Net 中

    Dim filename = Path.GetFileName(filepath)
    

    【讨论】:

    • 反对的选民,请留下您的评论。我真的很惊讶有人拒绝投票接受的答案并且没有留下任何cmets。
    猜你喜欢
    • 2011-04-13
    • 2011-07-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    • 2011-08-30
    • 1970-01-01
    相关资源
    最近更新 更多