找回密码
 加入
搜索
查看: 2413|回复: 9

如何读取txt中指定位置字符

[复制链接]
发表于 2009-11-3 19:11:26 | 显示全部楼层 |阅读模式
本帖最后由 qdhouri 于 2009-11-3 22:49 编辑

txt内容如下
052/020/a.exe

如何读取052/020这个几个字符?
发表于 2009-11-3 19:43:19 | 显示全部楼层
while 1
  if stringright($text, 1)= "/" then
     exitloop
  else
     $text = stringtrimright($text, 1)
  endif
wend
msgbox("","", stringtrimright($text, 1))
发表于 2009-11-3 21:24:58 | 显示全部楼层
$text = '052/020/a.exe'
$ok = StringRegExp($text, '(.+)/.*', 3) 
If @error = 0 Then MsgBox(0, 0, $ok[0])
 楼主| 发表于 2009-11-3 22:06:04 | 显示全部楼层
while 1
  if stringright($text, 1)= "/" then
     exitloop
  else
     $text = stringtrimright($text, 1)
  endif
wend
msgbox("","", stringtrimright($text, 1))
netegg 发表于 2009-11-3 19:43


超级感谢~
 楼主| 发表于 2009-11-3 22:06:21 | 显示全部楼层
$text = '052/020/a.exe'
$ok = StringRegExp($text, '(.+)/.*', 3)
If @error = 0 Then MsgBox(0, 0, $ok[0])
afan 发表于 2009-11-3 21:24



超级感谢~
发表于 2009-11-3 22:11:03 | 显示全部楼层
只是无意路过罢了
 楼主| 发表于 2009-11-3 22:37:17 | 显示全部楼层
再问下为什么换成 \ 就不好用了啊?

$text = '052\020\a.exe'
$ok = StringRegExp($text, '(.+)\.*', 3)
If @error = 0 Then MsgBox(0, 0, $ok[0])
发表于 2009-11-3 23:31:15 | 显示全部楼层
本帖最后由 newx 于 2009-11-3 23:32 编辑
$text = '052\020\a.exe'
$ok = StringRegExp($text, '(.*)\\(.*)\\(.*)', 3) 
If @error = 0 Then MsgBox(0, 0, $ok[0])
发表于 2011-7-28 19:07:34 | 显示全部楼层
呵。。。。不错。论坛里东西真全。拿走了
发表于 2012-4-21 22:24:44 | 显示全部楼层
学习........................
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-30 13:30 , Processed in 0.077726 second(s), 20 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表