fn filterstr str findstr &strs= (
ind = findstring str findstr
if ind !=undefined then (
if ind > 1 do (
cutstr = substring str 1 (ind-1)
append strs cutstr
)
levstr = substring str (ind + findstr.count) -1
filterstr levstr findstr &strs
)
else if str!="" then append strs str
)
firstInd
fn replaceString str findStr replaceStr filterStand:on =( --默认开启标准filter,需要使用逐字符过滤就关闭
strArr = #()
if filterStand then (
strArr = filterstring str findstr
) --filterstring "xxx-xxx-xxx" "x-x"结果为#()空,不是#("xx","x","xx")
else(
filterstr str findstr &strArr
)
firstInd = findstring str findstr
lastkey = findLaststring str findstr
result = ""
for i=1 to strArr.count do append result (strArr+replaceStr)
if lastkey+findstr.count != str.count+1 do result = substring result 1 (result.count-replaceStr.count) --替换字符串不为尾项就掐掉
if firstInd == 1 do result = replaceStr + result --替换字符串为首项就添加替换字符到最前
result
)
fn getMxs_ directory &pathArr=(
if directory != undefined and doesFileExist directory then (
mxsArr = getFiles (directory+"*.ms*")
mxsArr = for mxs in mxsArr where not (getFileAttribute mxs #hidden) collect mxs
join pathArr mxsArr
dirArr = getDirectories (directory+"*")
dirArr = for d in dirArr where not (getFileAttribute d #hidden) collect d
for d in dirArr do getMxs_ d pathArr
pathArr
)
else #()
)
fn filterstr str findstr &strs= (
ind = findstring str findstr
if ind !=undefined then (
if ind > 1 do (
cutstr = substring str 1 (ind-1)
append strs cutstr
)
levstr = substring str (ind + findstr.count) -1
filterstr levstr findstr &strs
)
else if str!="" then append strs str
)
firstInd
fn replaceString str findStr replaceStr filterStand:on =( --默认开启标准filter,需要使用逐字符过滤就关闭
strArr = #()
if filterStand then (
strArr = filterstring str findstr
) --filterstring "xxx-xxx-xxx" "x-x"结果为#()空,不是#("xx","x","xx")
else(
filterstr str findstr &strArr
)
firstInd = findstring str findstr
lastkey = findLaststring str findstr
result = ""
for i=1 to strArr.count do append result (strArr+replaceStr)
if lastkey+findstr.count != str.count+1 do result = substring result 1 (result.count-replaceStr.count) --替换字符串不为尾项就掐掉
if firstInd == 1 do result = replaceStr + result --替换字符串为首项就添加替换字符到最前
result
)
fn getMxs_ directory &pathArr=(
if directory != undefined and doesFileExist directory then (
mxsArr = getFiles (directory+"*.ms*")
mxsArr = for mxs in mxsArr where not (getFileAttribute mxs #hidden) collect mxs
join pathArr mxsArr
dirArr = getDirectories (directory+"*")
dirArr = for d in dirArr where not (getFileAttribute d #hidden) collect d
for d in dirArr do getMxs_ d pathArr
pathArr
)
else #()
)