跳转至

功能

函数可以对字符串进行运算,以获得定义的结果字符串。一般来说,可以使用以下函数:

Result string = $func::Function name( input parameter )

脚本软件包中提供以下功能:

$func::getfilename(<string>)

  • 根据传输的字符串确定文件名(不含后缀)。示例

    $func::getfilename(C:\Test\log.txt)  log
    $func::getfilename(C:\Test\log)  log
    $func::getfilename(log.txt)  log
    $func::getfilename("C:\Test\log.txt")  log
    $func::getfilename(C:\Test\log\) <empty>
    $func::getfilename() <empty>
    $func::getfilename("") <empty>
    
  • 使用通配符搜索文件(带后缀的名称)。例如

    $func::getfilename(C:\Test\*.txt)  C:\Test\test.txt (returns the first file that matches the search filter)
    

$func::getdir(<string>)

从传输的字符串中确定路径名。

示例

$func::getdir(C:\Test\log.txt)  C:\Test\
$func::getdir(C:\Test\log)  C:\Test\
$func::getdir(log.txt) <empty>
$func::getdir(C:\Test\log\)  C:\Test\log\
$func::getdir(NULL) <empty>
$func::getdir("") <empty>

$func::getshortdir(<string>)

将传输的路径转换为系统支持的简短形式。

示例

$func::getshortdir(p:\vdBuild\vdC\ExampleComponents\Schneider Modsoft CatExample)  p:\vdBuild\vdC\BEISPI~1\SCHNEI~2\

$func::getparentdir(<string>)

从传输的字符串中确定路径名。

示例

$func::getparentdir(C:\Test\log.txt)  C:\Test
$func::getparentdir(C:\Test\log)  C:\Test
$func::getparentdir(log.txt) <empty>
$func::getparentdir(C:\Test\log\)  C:\Test
$func::getparentdir(NULL) <empty>
$func::getparentdir("") <empty>

$func::getdrive(<string>)

根据传输的字符串确定驱动器字母。假定驱动器只用一个字母描述。如果无法识别驱动器字母,则返回值为空。

示例

$func::getdrive(C:\Test\log.txt)  C
$func::getdrive(C:\)  C
$func::getdrive(C$)  C
$func::getdrive(\\Network\C$)  C
$func::getdrive(\\Network\C$\Temp)  C
$func::getdrive(\\Network\C\Temp)  C
$func::getdrive(C\)  C
$func::getdrive(\\Network\Temp\C\Temp) <empty>
$func::getdrive(CD) <empty>
$func::getdrive() <empty>

$func::getsysvar(<string>)

确定分配给传输字符串的环境变量/系统变量。

示例

$func::getsysvar(TEMP)  returns the value behind the system variable "TEMP", in this case it would be the system's
temp directory.