如何取斜杠号后面的字串?(已解决)
本帖最后由 qq342252004 于 2013-5-11 18:16 编辑D:\Program Files\Thunder Network 这个路径取斜杠号后面的字串
结果是:Thunder Network前面的D:\Program Files\不要 $fullpath = "D:\Program Files\Thunder Network"
$position = StringInStr($fullpath, "\", 0, -1)
$foldername = StringMid($fullpath, $position+1)
MsgBox(0, "", $foldername) _WinAPI_PathFindNextComponent
;_WinAPI_PathFindNextComponent会把第一个\和它前面的去掉,所以要用循环一段一段去掉
#include <WinAPIEx.au3>
$fullpath = "D:\Program Files\Thunder Network"
$buf1 = $fullpath
$buf2 = ""
While True
$buf2 = _WinAPI_PathFindNextComponent($buf1)
If $buf2 = "" Then ExitLoop
$buf1 = $buf2
WEnd
MsgBox(0, "", $buf1)
Local $Str = 'D:\Program Files\Thunder Network'
MsgBox(0, StringRegExpReplace($str, '.+\\', ''), $Str) $str="D:\Program Files\Thunder Network\"
$arr=StringSplit($str,"\",2)
If $arr="" Then ReDim $arr
MsgBox(0,"",$arr)这样试下 回复 5# afan
向Afan学习,思路的确独特~Dim $str="D:\Program Files\Thunder Network"
$str=StringRegExp($str,"(?:.*\\)(.*)",3)
If Not @error Then MsgBox(0,"",$str) 谢谢大家,问题解决了。
页:
[1]