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


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

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

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


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/6/28 11:21:00 [只看该作者]

'Dim dtb As DataTable = DataTables("表e")
'Dim dtc As DataTable = DataTables("表k")
Dim ns As new List(of String)
ns.AddRange(new String() {"儿童","单房差","1-10号"})
'For Each dr As DataRow In dtb.DataRows
Dim str As String = "成人999,1-10号123,儿童3170,单房差1570" '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
    If n > "" Then
        p = val(ar.Replace(n,"")) - 10
        str &= n & p & ","
    Else
        str &= ar & ","
    End If

Next
msgbox(str.trim(","))
'Dim ndr As DataRow = dtc.AddNew
'ndr("价格")=str
'Next

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