代码输出结果
请问下面的代码中,str会输出什么样的结果?
lenfilename=len(CommonDialog1.filename)
for i=1 to lenfilename
temp=right(commondialog1.file,i)
if mid(temp,1,i)="\" then
str=right(temp,len(temp)-1)
exit for
next
请问下面的代码中,str会输出什么样的结果?
lenfilename=len(CommonDialog1.filename)
for i=1 to lenfilename
temp=right(commondialog1.file,i)
if mid(temp,1,i)="\" then
str=right(temp,len(temp)-1)
exit for
next
从右边找到第一个 \ 取出这个\ 右边的字符串
就是取得不带路径的文件名
这段代码看起来没有问题