Hi Paul,
If you just need to return the substrings delimited by "%%", the split is a
quick through.
Also the regex will give you more flexible function, but you need to know
the pattern first.
Here goes the codes
Dim myString As String = "**item1%%**item2%%**item3%%"
'return **item1,**item2,**item3, use split method
Dim myArray() As String = Split(myString, "%%", ,
CompareMethod.Text)
'use the regex method will be more flexible.
Dim r As Regex = New Regex("(item[0-9])%%", RegexOptions.IgnoreCase)
Dim mc As MatchCollection = r.Matches(myString)
For i As Integer = 0 To mc.Count - 1
'writeout item1,item2,item3,
Console.WriteLine(mc(i).Groups(1).ToString)
Next
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.