Programming2007
Programmer
Hi I have a huge file with numbers and white space. Each of the numbers in a specified position represents a field. The problem is that when I read the numbers at the specified position it takes whitespace into account. How do I avoid this? Below is my code:
Files = Directory.GetFiles("C:\\QuestLD", "*")
For Each File In Files
Dim fs As New FileStream(File, FileMode.Open, FileAccess.Read)
Dim sw As New StreamReader(fs)
rawFileData = sw.ReadToEnd()
rawFileData.Trim()
'410 digits in tuple
tuple = rawFileData.Substring(startIndex + startIndex, 410)
'tuple = rawFileData.Substring(startIndex, 20)
fs.Position = 67
ORIG_TIME = tuple.Substring(startIndex + 67, 6)
fs.Position = 116
ANI = tuple.Substring(startIndex + 116, 15)
fs.Position = 101
CALLED_NO = tuple.Substring(startIndex + 101, 15)
fs.Position = 51
ORIG_DT = tuple.Substring(startIndex + 51, 8)
sql_insert(ORIG_TIME, ANI, CALLED_NO, ORIG_DT)
startIndex = startIndex + 410
'separate line records by fields by groups in fields
Next File
End Sub
Files = Directory.GetFiles("C:\\QuestLD", "*")
For Each File In Files
Dim fs As New FileStream(File, FileMode.Open, FileAccess.Read)
Dim sw As New StreamReader(fs)
rawFileData = sw.ReadToEnd()
rawFileData.Trim()
'410 digits in tuple
tuple = rawFileData.Substring(startIndex + startIndex, 410)
'tuple = rawFileData.Substring(startIndex, 20)
fs.Position = 67
ORIG_TIME = tuple.Substring(startIndex + 67, 6)
fs.Position = 116
ANI = tuple.Substring(startIndex + 116, 15)
fs.Position = 101
CALLED_NO = tuple.Substring(startIndex + 101, 15)
fs.Position = 51
ORIG_DT = tuple.Substring(startIndex + 51, 8)
sql_insert(ORIG_TIME, ANI, CALLED_NO, ORIG_DT)
startIndex = startIndex + 410
'separate line records by fields by groups in fields
Next File
End Sub