Foxtable(狐表)用户栏目专家坐堂 → 关于混合字符数值的计算问题


  共有2216人关注过本帖平板打印复制链接

主题:关于混合字符数值的计算问题

帅哥哟,离线,有人找我吗?
bootes29
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:童狐 帖子:214 积分:1386 威望:0 精华:0 注册:2017/5/13 15:13:00
关于混合字符数值的计算问题  发帖心情 Post By:2017/6/28 9:43:00 [只看该作者]

各位老师早上好,
上次有个问题,就是混合字符串 成人3070,儿童3170,房差1570,每个-10元,转到另外一个表,
老师给了非常好的回答。
Dim dtb As DataTable = DataTables("表e")
Dim dtc As DataTable = DataTables("表k")
Dim ns As new List(of String)
ns.AddRange(new String() {"成人
图片点击可在新窗口打开查看此主题相关图片如下:换算.jpg
图片点击可在新窗口打开查看
","儿童","单房差"})
For Each dr As DataRow In dtb.DataRows
    Dim str As String = dr("价格")
    Dim arr() As String = str.Split(",")
    Dim n As String
    Dim p As Double
    str = ""
    For Each Ar As String In arr
        For Each n1 As String In ns
            If ar.Contains(n1) Then
                n = n1
                Exit For
            End If
        Next
        p = val(ar.Replace(n,"")) - 10
        str &= n & p & ","
    Next
    Dim ndr As DataRow = dtc.AddNew
    ndr("价格")=str
Next

 回到顶部
总数 11 1 2 下一页