Public Function GetBetween(ByRef strSource As String, ByRef strStart As String, ByRef strEnd As String, Optional ByRef startPos As Integer = 0) As String Dim iPos As Integer, iEnd As Integer, lenStart As Integer = strStart.Length Dim strResult As String = "" iPos = strSource.IndexOf(strStart, startPos) iEnd = strSource.IndexOf(strEnd, iPos + lenStart) If iPos <> -1 AndAlso iEnd <> -1 Then strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart)) End If Return strResult End Function 

mvs 2008 winform Please.

Closed due to the fact that the essence of the issue is incomprehensible to the participants of Kromster , pavel , αλεχολυτ , cheops , aleksandr barakin 25 Oct '16 at 10:12 .

Try to write more detailed questions. To get an answer, explain what exactly you see the problem, how to reproduce it, what you want to get as a result, etc. Give an example that clearly demonstrates the problem. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • You would at least "Please" write ... - skegg
  • no problem cha correct =) - rif009
  • one
    It is better to write what is not clear. We're not sitting here for “badges”) - BogolyubskiyAlexey
  • Yes, everything is unclear I need a class and TP for parsing with an HTML data code, for example, between <titel> </ titel> I’m a friend who gave me a code for wb and I don’t search at all - rif009
  • one
    No, then you need to learn VB, but is it worth it? And you intuitively try to guess what those or other elements of VB mean. You can raise some books and reference books. In general, be active and creative. - skegg

1 answer 1

I do not understand what the problem is, although if I were asked to rewrite something on VB, I would also think a little. And by the way, if you use .net, then it's better to go straight to C #:

 public string GetBetween(string strSource, string strStart, string strEnd, int startPos){ int iPos, iEnd, lenStart = strStart.Length; string strResult = ""; iPos = strSource.IndexOf(strStart, startPos); iEnd = strSource.IndexOf(strEnd, iPos + lenStart); if(iPos != -1 & iEnd != -1){ strResult = strSource.Substring(iPos + lenStart, iEnd - (iPos + lenStart)); } return strResult; } public string GetBetween(string strSource, string strStart, string strEnd){ return GetBetween(strSource, strStart, strEnd, 0); }