我的需求是这样的,有一个这样的对象,将b中包含a的对象前加@,没有包含的对象加#。然后输出为@1,@2,#3,#4,#5 写的vb代码是这样的,我在vs里面是可以使用的,但是在葡萄城里不能使用,报错。
Function stringHandle3(ByVal strA As String, ByVal strB As String) As String
Dim aCollection As IEnumerable(Of String) = strA.Split(","c)
Dim bCollection As IEnumerable(Of String) = strB.Split(","c)
Dim resultCollection As New List(Of String)
For Each item In bCollection
If aCollection.Contains(item) Then
resultCollection.Add("@" & item)
Else
resultCollection.Add("#" & item)
End If
Next
Dim resultStr As String = String.Join(",", resultCollection)
Return String.Join(",", resultCollection)
End Function
|