Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
iOS Development
Remove Duplicates in NSArray
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="spacehopper" data-source="post: 1745505" data-attributes="member: 388426"><p>Hi All,</p><p></p><p>I am trying to update an small part of an app and the last bit to do is remove duplicates from and array by their value. My array is as below, the key "title" has many duplicates and I want to remove them so there are no duplicate titles in the array.</p><p></p><p>[CODE]"<DCode: 0x17028</p><p>2017-01-21 16:09:14.233522 M-Code[1750:994133] (</p><p> "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n filePath = nil;\n fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n keyword = nil;\n logo = nil;\n logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n qrCode = nil;\n title = Agency;\n})",<DCode: 0x17028</p><p>2017-01-21 16:09:14.233522 M-Code[1750:994133] (</p><p> "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n filePath = nil;\n fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n keyword = nil;\n logo = nil;\n logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n qrCode = nil;\n title = Agency;\n})",<DCode: 0x17028</p><p>2017-01-21 16:09:14.233522 M-Code[1750:994133] (</p><p> "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n filePath = nil;\n fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n keyword = nil;\n logo = nil;\n logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n qrCode = nil;\n title = Something Else;\n})",[/CODE]</p><p></p><p>I want to keep the array as it is but for the example above their should only be 2 items in the array, "Something" and "Agency" as currently "Agency" is repeated.</p><p></p><p>This creates the array</p><p>[CODE]cards = [DCode MR_findAllSortedBy:@"title" ascending:YES];[/CODE]</p><p></p><p>Any help is appreciated.</p></blockquote><p></p>
[QUOTE="spacehopper, post: 1745505, member: 388426"] Hi All, I am trying to update an small part of an app and the last bit to do is remove duplicates from and array by their value. My array is as below, the key "title" has many duplicates and I want to remove them so there are no duplicate titles in the array. [CODE]"<DCode: 0x17028 2017-01-21 16:09:14.233522 M-Code[1750:994133] ( "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n filePath = nil;\n fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n keyword = nil;\n logo = nil;\n logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n qrCode = nil;\n title = Agency;\n})",<DCode: 0x17028 2017-01-21 16:09:14.233522 M-Code[1750:994133] ( "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n filePath = nil;\n fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n keyword = nil;\n logo = nil;\n logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n qrCode = nil;\n title = Agency;\n})",<DCode: 0x17028 2017-01-21 16:09:14.233522 M-Code[1750:994133] ( "<DCode: 0x17009f5e0> (entity: DCode; id: 0xd000000005680000 <x-coredata://01C37C8D-468B-47D5-9C18-5FACCF313A81/DCode/p346> ; data: {\n filePath = nil;\n fileUrl = \"http://domain.companel/uploads/qrcodes/48_agency_qr.png\";\n keyword = nil;\n logo = nil;\n logoUrl = \"http://domain.com/panel/uploads/logo-small_1480159225.png\";\n qrCode = nil;\n title = Something Else;\n})",[/CODE] I want to keep the array as it is but for the example above their should only be 2 items in the array, "Something" and "Agency" as currently "Agency" is repeated. This creates the array [CODE]cards = [DCode MR_findAllSortedBy:@"title" ascending:YES];[/CODE] Any help is appreciated. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
iOS Development
Remove Duplicates in NSArray
Top