2008/5/9 Joshua Paul <[EMAIL PROTECTED]>:

> In this specific instance i was looking for intersecting strings from two
> arrays.
> Nevertheless, I'm always curious to see how people solve various problems,
> so if you're willing to share, please pass along a code snippet.
>

NSArray first, second; //assume they exist and contian your strings

NSSet firstSet = new NSSet(first);
NSSet secondSet = new NSSet(second);
NSSet intersectingsSet = firstSet.setByIntersettingSet(secondSet);

NSArray myIntersectedArray = intersectingsSet.allObjects();


> TIA.
>
> On May 8, 2008, at 5:26 PM, Don Lindsay wrote:
>
> Are you looking for a substring of a string in an array?  Or are you
> looking for the whole string?  I have written a routine to find the
> substring of a string in an array, if that would help.
> Don
> On May 8, 2008, at 9:39 AM, Daniele Corti wrote:
>
>
>
> 2008/5/8 Joshua Paul <[EMAIL PROTECTED]>:
>
>> Thanks all...
>> it was a matter of upper/lowercase.
>>
>
> Well, can you insert a toLowerString() while creating the array? if not,
> you must iterate over the array and check each element after use
> toLowerCase().
>
> for exaple:
>
> NSArray first, second
>
> for(int i = 0; i < first.count(); i++)
> {
>    String elemFirst = (String)first.objectAtIndex(i);
>    for(int j = 0 ; j < second.count(); j++)
>    {
>       String elemSecond = (String)second.objectAtIndex(j);
>       if(elemFirst.equalsIgnoreCase(elemSecond))
>       {
>          //Do what you need to do
>       }
>    }
> }
>
>
>>
>> On May 8, 2008, at 6:10 AM, David Avendasora wrote:
>>
>> That and make sure you aren't using "contains(Object element)" as that is
>> not the same as "contains*Object*(Object object)". This bit me a couple
>> times before I quit making that mistake - usually in the wee hours of the
>> morning.
>> Dave
>>
>> On May 8, 2008, at 8:00 AM, Miguel Arroz wrote:
>>
>>  Yap. containsObject compares objects using equals(), so it should work
>> for Strings. If you are not finding the string with this, it's because it's
>> not on the array. :) Maybe you need to trim() some white spaces?
>>
>>
>>
>>   --
>> Josh Paul
>> [EMAIL PROTECTED]
>>
>> twitter: joshpaul
>> linkedin: joshpaul
>>
>>
>> NOTICE: This e-mail message and all attachments transmitted with it are
>> intended solely for the use of the addressee and may contain legally
>> privileged and confidential information. If the reader of this message is
>> not the intended recipient, or an employee or agent responsible for
>> delivering this message to the intended recipient, you are hereby notified
>> that any dissemination, distribution, copying, or other use of this message
>> or its attachments is strictly prohibited. If you have received this message
>> in error, please notify the sender immediately by replying to this message
>> and please delete it from your computer.
>>
>>
>
>
> --
> Daniele Corti
> AIM: S0CR4TE5
> Messenger: [EMAIL PROTECTED]
>
> --
> Computers are like air conditioners -- they stop working properly if you
> open
> WINDOWS
>
> --
> What about the four lusers of the apocalypse? I nominate:
> "advertising", "can't log in", "power switch" and "what backup?"
> --Alistair Young _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/pccdonl%40mac.com
>
> This email sent to [EMAIL PROTECTED]
>
>
>
> --
> Josh Paul
> [EMAIL PROTECTED]
>
> twitter: joshpaul
> linkedin: joshpaul
>
>
> NOTICE: This e-mail message and all attachments transmitted with it are
> intended solely for the use of the addressee and may contain legally
> privileged and confidential information. If the reader of this message is
> not the intended recipient, or an employee or agent responsible for
> delivering this message to the intended recipient, you are hereby notified
> that any dissemination, distribution, copying, or other use of this message
> or its attachments is strictly prohibited. If you have received this message
> in error, please notify the sender immediately by replying to this message
> and please delete it from your computer.
>
>


-- 
Daniele Corti
AIM: S0CR4TE5
Messenger: [EMAIL PROTECTED]

--
Computers are like air conditioners -- they stop working properly if you
open
WINDOWS

-- 
What about the four lusers of the apocalypse? I nominate:
"advertising", "can't log in", "power switch" and "what backup?"
--Alistair Young
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to