OK so this is really doing my head in since I am using VB to convert to C# and the variable names don't help in addition to the whole zero counts as 1 in C#
how do I convert this to C#? I mean...I think I got it but the problem is, when comparing the output between the C'# and VB, it always is out by 1 number (C# is 1 number ahead)Code:Public Function Parsec(stmt As Variant, delim As String, stmtinx() As Long) As Long Dim i As Long Dim j As Long Dim k As Long Dim l As Long Dim m As Long k = UBound(stmtinx) - 2 m = Len(delim) Erase stmtinx If (m < 1) Then Exit Function i = 1 For l = 1 To k stmtinx(l) = i j = InStr(i, stmt, delim) If (j < 1) Then Exit For i = j + m Next stmtinx(l + 1) = Len(stmt) + 1 stmtinx(0) = l Parsec = l End Function
whether or not this is correct when it comes to C# land - im not sure. I think it is.
here is the data I use to put through the function:
I hope someone can help mestmt = " | |08/16/2012 21:46:01|0799555065|*205505555555558|001029604658953|038800C8080801140010296046589533106507995550650 2C050000|310650799555065|08/08/2012 08:01:20||||xxx||||||||||||||||||||||||||||||||||||||||||||||"
delim = "|"
stmtinx is an array length of 96 in VB:
Dim stmtinx(96) as longmy brain is...frazzled




my brain is...frazzled

any chance of a regain?
Reply With Quote