searching elements of an array within another array

From: diffused (vckorovski_at_dialectsolutions.com)
Date: 07/30/04


Date: 29 Jul 2004 22:40:49 -0700

Is it possible to search using each element in a array, to see if it
exists in another array?

I have two string arrays, one is hardcoded, the other one is parsed
from a XML file.

String[] arrayStrField = {"ClinicId","ClinicName",
"KmRangePostcode","Suburb","State","ClinicPostcode", "Doc",
"DateLastChanged", "AdditionalPostcodes", "ClinicStatus",
"ClinicURL"};

pXmlMsg.mArrField[i] = pXmlField.getElement(i).asString();

How would i search element by element in the mArrField to see if each
element exists as one of the elements in the arrayStrField?

ie ..

boolean activeField = checkFieldArray(arrayStrField,
xmlMess.mArrField);

private boolean checkFieldArray(String[] arrayStrCheck, String[]
arrayStrVar)
        {
                boolean b = false;
                
                // if (all arrStrVar[i] do exist in arrayStrCheck[]
                    {
                    b = true;
                    }
                
                
                return b;
        }

how would i go about doing this?



Relevant Pages

  • searching elements of an array within another array
    ... Is it possible to search using each element in a array, ... I have two string arrays, one is hardcoded, the other one is parsed ... element exists as one of the elements in the arrayStrField? ... boolean activeField = checkFieldArray(arrayStrField, ...
    (comp.lang.java.programmer)
  • Re: Mergring two string Arrays
    ... I've two string arrays A & B. One of it is sorted B. A is not sorted. ... I want array A to be same as array B. So I was thinking the following is ... Free games and programming goodies. ...
    (comp.lang.c)
  • Re: Mergring two string Arrays
    ... I've two string arrays A & B. One of it is sorted B. A is not sorted. ... Now I want array A to be same as array B. So I was thinking the following is the right way: ... Free games and programming goodies. ...
    (comp.lang.c)
  • array comparison and sort
    ... I am running into this problem of getting my array to output the ... i have two string arrays via ... compare elements of ar1 and ar2 with one another and the moment it ... starts comparing from index->1 and same logic apllies. ...
    (comp.lang.java.programmer)
  • Re: Mergring two string Arrays
    ... !GNITSOP-POT POTS ESAELP ... I've two string arrays A & B. One of it is sorted B. A is not sorted. ... want array A to be same as array B. So I was thinking the following is the ...
    (comp.lang.c)