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 8238803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:56:14+00:00 2026-06-07T19:56:14+00:00

I have a two string like SANFRANSICO and CHICAGO Now i want to make

  • 0

I have a two string like “SANFRANSICO” and “CHICAGO”

Now i want to make it like the string is in reverse but in a single string like “OOCGIASCNIAHRCFNAS”

I have done code but it gives me wrong result

check out my code

- (NSString *)changeString1:(NSString *)string string2:(NSString *)string2{
    int first = [string length];
    int second = [string2 length];
    int total = first+second;
    NSMutableString *str = [[NSMutableString alloc] init];
    string = [self reverseString:string];
    string2 = [self reverseString:string2];

    for (int i=0; i<total+1; i++) 
    {
        if (i%2==1) {
            int j = i/2;
            if(j < second){
                NSString *ichar  = [NSString stringWithFormat:@"%c", [string2 characterAtIndex:j]];
                [str appendString:ichar];
            }
            else{
                NSString *ichar  = [NSString stringWithFormat:@"%c", [string characterAtIndex:j+1]];
                NSLog(@"222 %d %@",j+1, ichar );
                [str appendString:ichar];
                check = YES;
            }
        }
        else {
            int j = i/2;
            if(check == YES){
            }
            else{
                NSString *ichar  = [NSString stringWithFormat:@"%c", [string characterAtIndex:j]];
                 NSLog(@"1111 %d %@",j, ichar );
                [str appendString:ichar];
            }
        }
    }
    return str;

}
  • 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-07T19:56:16+00:00Added an answer on June 7, 2026 at 7:56 pm

    I found the answer very soon after post this question sorry for posting this question

    check out my answer

    - (NSString *)changeString1:(NSString *)string string2:(NSMutableString *)string2{
        int first = [string length];
        int second = [string2 length];
        string = [self reverseString:string];
        string2 = [self reverseString:string2];
    
        for(int i =second; i<first; i ++){
            [string2 appendString:@" "];
        }
       int total = first*2;
        NSMutableString *str = [[NSMutableString alloc] init];
        for (int i=0; i<total; i++) 
        {
            if (i%2==1) {
                int j = i/2;
                if(j < second){
                    NSString *ichar  = [NSString stringWithFormat:@"%c", [string2 characterAtIndex:j]];
                    [str appendString:ichar];
                }
            }
            else {
                int j = i/2;
                if(j < first){
                    NSString *ichar  = [NSString stringWithFormat:@"%c", [string characterAtIndex:j]];
                    [str appendString:ichar];
                }
                else{
                    NSString *ichar  = [NSString stringWithFormat:@"%c", [string2 characterAtIndex:j]];
                    [str appendString:ichar];
                }
            }
        }
        NSLog(@"str %@", str);
        return str;
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have two string that were padded, but now I want them show
i have two datetime string like this '2010-08-31 04:35:50.176725' and '2010-09-05 04:35:50.176725' . now
I have this type of two String. Now i want to display these two
I have declared two string buffers like, private StringBuffer buf = new StringBuffer(1024); private
Suppose I have a string like this: one two three four five six seven
Supposed I have two classes like this: public class Parent { public string Id
I have two tables which looks something like this Table Queue int ID; string
I would like to have a mapping which maps two string into one string.
I have simple form like this which accepts only two values string action and
I have a list like this Dim emailList as new List(Of String) emailList.Add(one@domain.com) emailList.Add(two@domain.com)

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.