mpappert
Regular
I'm just wondering if there is a .NET method for doing this tedious task ... I have data set (obtained from swiping a magnetic card) that is stored in a single string ...
The data is separated sometimes by actual field length, and in some instances by separators. I am using code like this to parse the data and was wondering if there was a better .NET method for handling strings in this manner ...
TIA!
M.
The data is separated sometimes by actual field length, and in some instances by separators. I am using code like this to parse the data and was wondering if there was a better .NET method for handling strings in this manner ...
TIA!
M.
Visual Basic:
' Card Number
m_strCardNumber = Mid$(strSwipeData, 9, 10)
' First, Middle, Last from "^Last/First Middle^"
' Last ends at a '/', First and Middle separated by Space
' enclosed in '^' (carots)
For iLoop = 1 To Len(strSwipeData)
Select Case Mid$(strSwipeData, iLoop, 1)
Case "^"
If intNameLOC_Begin = 0 Then
intNameLOC_Begin = iLoop + 1
Else
intNameLOC_End = iLoop + 1
Exit For
End If
Case "/"
intNameLOC_FirstName = iLoop + 1
Case " "
intNameLOC_MiddleName = iLoop + 1
End Select
Next iLoop
m_strName_Last = Mid$(strSwipeData, intNameLOC_Begin, intNameLOC_FirstName - intNameLOC_Begin - 1)
m_strName_First = Mid$(strSwipeData, intNameLOC_FirstName, intNameLOC_MiddleName - intNameLOC_FirstName - 1)
m_strName_Middle = Mid$(strSwipeData, intNameLOC_MiddleName, intNameLOC_End - intNameLOC_MiddleName - 1)