以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]字符串的第一个字母 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=12136) |
||||||||||
-- 作者:yjk1023 -- 发布时间:2011/8/24 8:29:00 -- [求助]字符串的第一个字母 字符串存放在A列 ,如果字符串的第一个字母是1-9那么在B列中显示1-9,如果字符串的第一个字母是U在B列显示U,其他的显示0 如何实现
|
||||||||||
-- 作者:yjk1023 -- 发布时间:2011/8/24 8:56:00 -- 自己的问题自己解答 Dim dr As DataRow = e.DataRow |
||||||||||
-- 作者:c -- 发布时间:2011/8/24 9:44:00 -- 也可以截取第一个字母来判断!
Dim a As String = "U123456" |
||||||||||
-- 作者:yjk1023 -- 发布时间:2011/8/24 10:15:00 -- 来个全码 Dim dr As DataRow = e.DataRow |
||||||||||
-- 作者:czy -- 发布时间:2011/8/24 11:06:00 -- Dim dr As DataRow = e.DataRow If e.DataCol.Name = "A" Then If dr.IsNull("A") = False Then If IsNumeric(dr("A").SubString(0,1)) Then If dr("A").SubString(0,1) <> 0 Then dr("B") = dr("A").SubString(0,1) Else dr("B") = 0 End If Else If dr("A").SubString(0,1) = "U" Then dr("B") = "U" Else dr("B") = 0 End If End If End If End If |
||||||||||
-- 作者:程兴刚 -- 发布时间:2011/8/24 12:23:00 -- Dim dr As DataRow = e.DataRow |
||||||||||
-- 作者:czy -- 发布时间:2011/8/24 12:51:00 --
[此贴子已经被作者于2011-8-24 13:01:53编辑过]
|