以文本方式查看主题 - 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=180061) |
-- 作者:edisontsui -- 发布时间:2022/9/26 11:19:00 -- 取得姓名最后一个字符 If e.DataCol.Name = "完成人" Then Dim cnts As Integer = e.DataRow("完成人").length Dim st As String For cnt As Integer = 0 To cnts - 1 If e.DataRow("完成人").substring(cnt) = "," Then st = st & e.DataRow("完成人").substring(cnt - 1) & "," MsgBox(st) End If Next e.DataRow("操作员") = st & e.DataRow("完成人").substring(cnts - 1) End If “完成人”的内容:安大芬,曾桂花,寸待熬。面代码我希望取得“完成人”的姓名字符串最后一个字符,在e.DataRow("操作员")得出:芬,花,熬。但是实际运行结果只得出了“熬”字。MsgBox(st) 没有显示任何信息。请问是问什么呢?谢谢。
|
-- 作者:有点蓝 -- 发布时间:2022/9/26 11:25:00 -- 使用split根据逗号拆分姓名为数组:http://www.foxtable.com/webhelp/topics/0245.htm 然后遍历数组取每个姓名的右边一个字:http://www.foxtable.com/webhelp/topics/3264.htm,再重新合并为一个字符串
|