【问题标题】:Finding the base file name查找基本文件名
【发布时间】:2014-02-14 16:08:30
【问题描述】:

找到正在进行的基本文件名的最简单方法是什么。

我有:

 /tmp/admin/run/test.txt

我想要:

 test.txt

10.2b

【问题讨论】:

    标签: progress-4gl openedge


    【解决方案1】:

    使用 R-INDEX() 函数找到最右边的“/”。

    define variable path as character no-undo initial "/tmp/admin/run/test.txt".
    
    display
      path format "x(60)" skip 
      substring( path, r-index( path, "/" ) + 1 ) format "x(60)"
    .
    

    【讨论】:

    • 你有一个 ) 不合适的地方,但之后效果很好。谢谢!
    • 这也只适用于 unix 风格的目录分隔符 - windows 使用“\”。
    • 糟糕,已修复。该代码在错误检查等方面也相当简单——重点只是为了展示总体思路。
    猜你喜欢
    • 2016-12-09
    • 1970-01-01
    • 2011-05-07
    • 1970-01-01
    • 2013-07-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-27
    相关资源
    最近更新 更多