Dim str As String = "字段名1|80|字段名2|90|字段名3|100"
Dim cn As String = "字段名3"
Dim idx As Integer = str.IndexOf(cn)
If idx > -1 Then
Dim str2 As String = str.SubString(idx + cn.Length + 1)
Dim idx2 As Integer = str2.IndexOf("|")
If idx2 > -1 Then
cn = cn & "|" & str2.SubString(0,idx2+1)
Else
cn = str.SubString(IIF(idx = 0,idx,idx-1))
End If
Output.Show(cn)
End If
str = str.Replace(cn,"")
Output.Show(str)