I have to search for the first match of any string in an string array in a textbox starting from a certain position. Like if I have this string array:
string[] s = { "RTS", "RTL" };
And this code:
LDA #$43
STA $1000,x
CMP $00
BEQ .main
.return
RTS
.main
add $01
RTL
It should return RTS since that’s the first match (not the RTL). How can I do this? Additionally, would there be a better way of doing this rather than using an array?
Edited since I gave a bad example of what I was trying to do.
There may be algorithms to do this efficiently, but I don’t know of any. Fortunately this can be represented easily in code through basic searching.
This should be able to run in parallel fine. If not, remove
AsParallel().An alternative approach is to iterate through the string checking for the words picking the first that occurs.
It should perform better than the first.If you’d want the best in terms of efficiency, you’d have to write up a state machine for this but would be very complicated for a simple search of 2 (or more) words.