0

I'm probably just overcomplicating things...

Both of the arrays I'm using are arrayLists, what I'm trying to do is, most/all of array1 will be in array2, array1 however holds 5 digits strings and array2 (also strings) has a longer string which possibly starts with the first 5 digits of array1.

So if that makes sense, what I'm trying to do is using array1's each string, searching array2 for it and when found, I want the whole string, and I'm going to create a new arraylist for those.

I'm not sure what's slipping me up! .Contains seems to not find anything in array2, even though array1 has say "00111" and array2 has "00111, FIND for 8043890132", I'm guessing that's because it's looking for exactly "00111"?

      For Each unfoundLo In arrUnfoundInLo           

                 If arrCorList.IndexOf(unfoundLo) Then      '
4

1 に答える 1

1

私が見たものからはわかりませんが、ループを1つだけ実行していると思います。

両方の配列でループする必要があります

For Each item1 In array1
    For Each item2 In array2
        If item2.Contains(item1) Then

または、配列 2 をループして、数値部分を取得します

For Each item2 In array2
    numberPart = item2.SubString(0, 5)

    If array1.Contains(numberPart) Then

* これらは例であり、実際に使用するコードではありません

于 2013-04-17T17:07:31.657 に答える