'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
|