sdlw999 发表于 2010-1-11 14:39:54

[已解决]请教如何从GUICtrlCreateInput中读取从右边数第一个“\”后边的字符

本帖最后由 sdlw999 于 2010-1-11 20:43 编辑

如 D:\Documents\My Documents\My Music
就是读取: My Music

谢谢!

kn007 发表于 2010-1-11 15:56:14

MsgBox(0,"",_pathright("D:\Documents\My Documents\My Music"))



Func _pathright($Dir);用来提取最后一个“\”后面的字符串
      $set = ""
                While 1
                        $str = StringRight($Dir, 1)
                        Select
                              Case $str = ""
                                        Return
                              Case $str = "\"
                                        ExitLoop
                              Case Else
                                        $Dir = StringTrimRight($Dir, 1)
                                        $set = $str & $set
                        EndSelect
                WEnd
      Return $set
EndFunc   ;==>_pathright

顽固不化 发表于 2010-1-11 15:59:45

$FullPath="D:\Documents\My Documents\My Music"
$FileName=StringRegExp($FullPath,"\\(.[^\\]*)$",3)
MsgBox(0,0,$FileName)

sdlw999 发表于 2010-1-11 16:01:53

谢谢各位热心帮助!

afan 发表于 2010-1-11 16:06:55

$FullPath = 'D:\Documents\My Documents\My Music'
MsgBox(0, 0, StringRegExpReplace($FullPath, '.+\\', ''))

kn007 发表于 2010-1-11 16:07:19

谢谢各位热心帮助!
sdlw999 发表于 2010-1-11 16:01 http://www.autoitx.com/images/common/back.gif


    修改标题为 已解决 是对我们最好的感谢

gapkiller 发表于 2010-1-11 17:50:25

是不是搞太复杂了
不是有个简单的么...
$str=StringSplit("D:\Documents\My Documents\My Music", "\")
msgbox(0,0,$str[$str])

sanmoking 发表于 2010-1-11 18:01:05

楼上正解,楼上的楼上 那些个高手们是在秀自己的武功呢,大家欣赏欣赏就好了。

rst52013353 发表于 2012-8-23 00:37:52

哈哈```````还是5楼的高手的好用啊`````

xiehuahere 发表于 2012-8-23 10:43:03

本帖最后由 xiehuahere 于 2012-8-23 10:46 编辑

这个贡献加得够多~~
我也来讨点。

$FullPath = 'D:\Documents\My Documents\My Music'
MsgBox(0, "", StringTrimLeft($FullPath, StringInStr($FullPath, '\', 0, -1)))
页: [1]
查看完整版本: [已解决]请教如何从GUICtrlCreateInput中读取从右边数第一个“\”后边的字符