以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]怎样通过代码转换格式的问题 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=30841) |
||||||||
-- 作者:54292550 -- 发布时间:2013/4/5 0:32:00 -- [求助]怎样通过代码转换格式的问题 要求: 最后经过转换第一行的结果:(无小数点)
请问怎样通过代码实现这个转换?
|
||||||||
-- 作者:FoxMan -- 发布时间:2013/4/5 1:30:00 -- Dim s1,s2 ,s3 As String Dim t1 As Table =Tables("表A") Dim v As Double Dim r1 As Row =t1.Current If r1 IsNot Nothing AndAlso r1("第一列") > "" Then For Each c As Col In t1.Cols s1=r1(c.name)
s2=s1.replace(".","") If Double.TryParse(s1,v) Then \'如果转换成功 Dim n1 As Integer = s2.Length s3 = s3 & Format(val(s2),New String("0",iif(n1 <6,5,n1))) Else s3 = s3 & s1 End If Next Output.Show(s3) End If
[此贴子已经被作者于2013-4-5 10:58:24编辑过]
|