caught in Infinite loop

Hogfarmer

Member
Joined
Jul 29, 2009
Messages
8
Programming Experience
1-3
Hello, I am trying to eventually parse a string and here is what I have so far but it doesn't progress.
Madstr="7-8-9-10"


Do Until Mid(Madstr, t, 1) = "-"
Response.Write(Mid(Mad, t, 1))
t = t + 1
Loop
 
If that's the pattern (numbers separated by hyphens) then I'd suggest you save yourself a bunch of coding and use Regular Expressions.
 
So this is a 3rd party piece of software? It needs to be installed with admin permissions, on the server? This could be a big hurdle given my high secure environment. Or is it a seperate standalone util only used when needed?

**Oh it's a class?
 
Last edited:
It's all in the .Net Framework already:
VB.NET:
Imports System.Text.RegularExpressions

Public Class Form1

    Private m_RegEx As New Regex("YourPatternHere")

End Class
All you need is the pattern to match against, I'm not good with RegEx patterns but in your case I doubt it'd be all that hard.

If you don't want to get into RegEx (though this would be a good time to do it in case you need to know how to do other types of pattern matching) You could just Split() the string into an array with the hyphen being the split char:
VB.NET:
Dim Pieces() As String = Madstr.Split("-"c)
For Counter As Integer = 0I To Pieces.GetUpperBound(0I)
    Response.Write(Pieces(Counter))
Next Counter
 
Back
Top