Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9011067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:37:47+00:00 2026-06-16T02:37:47+00:00

I have two comma seperated NSString ‘s & I want to remove the similar

  • 0

I have two comma seperated NSString‘s & I want to remove the similar characters from first string only.

ex. str1 = 0,1,2,3
    str2 = 1,2.
    output -> str1 = 0,3 and str2 = 1,2.

I have one option that, seperate both the string with comma seperated values in a array. But it requires two NSArray‘s & apply loop and then remove the common elements, but it is very tedious job.
So I want some simple & proper solution which avoid the looping.

kindly help me to sort out this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T02:37:48+00:00Added an answer on June 16, 2026 at 2:37 am

    Try this one:

    No loop is required!!!

    You have got all the required APIs.

    NSString *str1=@"0,1,2,3";
    NSString *str2=@"1,2";
    
    NSMutableArray *arr1=[[NSMutableArray alloc]initWithArray:[str1 componentsSeparatedByString:@","]];
    
    [arr1 removeObjectsInArray:[str2 componentsSeparatedByString:@","]];
    NSLog(@"arr1 %@",arr1);
    /*
    NSMutableString *finalString=[NSMutableString new];
    
    for (NSInteger i=0; i<[arr1 count]; i++) {
        NSString *str=[arr1 objectAtIndex:i];
    
        [finalString appendString:str];
        if (i!=[arr1 count]-1) {
          [finalString appendString:@","];  
        }
    }
    */
    NSString *finalString=[arr1 componentsJoinedByString:@","];
    NSLog(@"finalString %@",finalString);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's consider I have two comma separated strings as written below. string name =
I have two tables. First Table is a batch table that contain comma separated
I have a php comma seperated string $string = (x,y,z) I have a column
I have two comma-separated selectors; .class, .foo, .bar .lorem, .ipsum, .potato I'd like to
I have two classes (MVC view model) which inherits from one abstract base class.
I have two update panels on a page. And I want to update both
Possible Duplicate: comparing two strings with comma seperated values I am working in C++,
I have a SQL CLR function which at the moment returns a string seperated
I have four string as listed below. Though they have different order of characters
Need help figuring this out. I have two tables user ---- name skills (comma

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.