Re: [AHK-] SplitPath 中文許功蓋問題
我發現之前的有點錯誤
所以又改了一下
-
f_LastIsBackslash(Path)
{
if SubStr(Path, 0) = "\" ; if last is \
{
StringTrimRight, Path, Path, 1 ; trim last \
Loop
{
if Path =
return Mod(A_Index, 2)
if Asc(SubStr(Path, 0)) < 128 ; if last char is not lead byte
return Mod(A_Index, 2) ; if 1, last char is \
else
StringTrimRight, Path, Path, 1 ; trim last, go to next char
}
}
else
return 0
}
f_SplitPath(Path, ByRef FileName, ByRef Dir)
{
Temp = %Path%
Loop
{
if f_LastIsBackslash(Temp)
{
FileNameLength := A_Index-1
break
}
else
StringTrimRight, Temp, Temp, 1 ; trim last, go to next char
}
StringRight, FileName, Path, FileNameLength
StringTrimRight, Dir, Path, FileNameLength+1
return
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.228.79.133
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
EzHotKey 近期熱門文章
PTT數位生活區 即時熱門文章