以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  关于截取字符  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=132545)

--  作者:爱相随
--  发布时间:2019/3/24 18:17:00
--  关于截取字符
老师,下面代码是截取最后四位字符:
If e.DataCol.Name = "银行账号" AndAlso e.newvalue > "" AndAlso e.newValue.length > 3 Then \'发生变化的是产品编号吗?
    e.DataRow("账号") = e.newValue.SubString(e.newValue.Length - 4) \'获得右边4个字符
End If

截取左边四位字符串不是这样的吗??
If e.DataCol.Name = "银行账号" AndAlso e.newvalue > "" AndAlso e.newValue.length > 3 Then \'发生变化的是产品编号吗?
    e.DataRow("账号") = e.newValue.SubString(e.newValue.Length 3 ) \'获得左边4个字符
End If

为什么不对呢???深奥啊。。。

--  作者:有点甜
--  发布时间:2019/3/24 22:29:00
--  

改成,比如

 

e.DataRow("账号") = e.newValue.SubString(0, 4) \'获得左边4个字符

 

http://www.foxtable.com/webhelp/scr/0240.htm

 


--  作者:爱相随
--  发布时间:2019/3/24 23:22:00
--  
谢谢老师