[Help]Compare Values in .txt[Solved]

Posts 1–8 of 8 · Page 1 of 1
[Help]Compare Values in .txt[Solved]
Hey i am trying to do this.

00907A50 000000XX
00907A51 000000XX
00907A52 000000XX
00907A53 000000XX
00907A54 000000XX
00907A55 000000XX
00907A56 000000XX
00907A57 000000XX

Search for `00907A57` in txt file and goes to end of line to find `XX`. It compares the `XX` value to preexisting values.

For example 00907A50 0000001A

The program would search for `00907A50` and then go to the end of the line and find `1A` and then it compares this value to preexisting ones. 1A would be AK47.

How would you search for the last two values of a line and compare it to preexisting values
I don't get you =O
basically how do you read the last two values of each line in a txt file?
And those two values can be any alphabet or number.
What. What you're saying doesn't make any sense. /request close
It does make sense, But isn't easily achieved, best bet is to load the Tab Delimited into a LIstbox then remove duplicates using the collection object
Meh. NextGen understands all! just leave it to him =P
If you want to get the last two values of the line, just split and filter the string and get the last 2 values !!

Here's the code. I wrote the code assuming the string is space delimited, but you can change it according to your needs;

[php]'Suppose you have this line. And you want to extract '00907A50 000000XX'
Dim str As String = "Create an integer / boolean value to hold a value"


'Just split the line using a space or tab or whatever way your string is formatted...
Dim x() As String = str.Split(" ")


'Create an integer / boolean value to hold a value
Dim temp As Integer = 0
'The final string to return after splitting..
Dim strToReturn As String = ""
'Loop through splitted string.
For Each m As String In x
'If temp = x.Count - 2 then add the value of m to strToReturn and add a space to keep the formatting.
If temp = x.Count - 2 Then
strToReturn += m & " "

Else
'Just increment temp val and continue loop
temp += 1
Continue For
End If
Next

'Finally display / get the output.
MsgBox(strToReturn)



[/php]

EDIT: Shit, I didn't understand the question fully. Anywayz that is easy too, I'll work it out and let you know !!
That's not going to help MJ, but anyway, the most simplistic way is not string manipulation but using a list box and checking for duplicates, considering the application already has and loads into a listbox , Collection object is more practical.

However, I am pretty sure that he is doing something completely different, I will mark this thread as solved and if he has any further questions it will remain open
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us