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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:59:00+00:00 2026-06-17T23:59:00+00:00

I have three type of string and i want to format that string to

  • 0

I have three type of string and i want to format that string to get street number, street name, city name.

The first type is : 34 Ellis Street, San Francisco
Here i want to make it like 
street number : 34
street name : Ellis Street
city name : San Francisco


The second type is : 4FL, 800 Market Street, San Francisco
Here i want to delete 4FL, 
And i want to make it like 
street number : 800
street name : Market Street
city name : San Francisco

The third type is : Ellis & Market, San Francisco
Here i want to make it like 
street number : 
street name : Ellis & Market
city name : San Francisco

How can i do this or any link that show string formatting like this than please suggest.And yes the string i write here is just a format of string i get,string will be changed every time.

  • 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-17T23:59:01+00:00Added an answer on June 17, 2026 at 11:59 pm

    The address string is passed to this method and then it is converted into an array having 3 string objects containing streetNumber, streetName and cityName. Then the array is returned to the caller.

    -(NSArray *)brakeAddress:(NSString *)address{
    
         NSMutableArray *arr=[NSMutableArray arrayWithArray:[address componentsSeparatedByString:@","]];
    
         if (arr.count>2) {
         [arr removeObjectAtIndex:0];
         }
    
         NSInteger streetNameInd=[arr count]-2, cityNameInd=[arr count]-1;
    
         NSMutableArray *streetNameArray=[NSMutableArray arrayWithObjects:arr[0], nil];
    
         if ([arr[streetNameInd] intValue]) {
    
         streetNameArray=[NSMutableArray arrayWithArray:([arr[streetNameInd] componentsSeparatedByString:@" "])];
    
         [streetNameArray removeObjectAtIndex:0];
         if ([streetNameArray[0] intValue] ==[arr[streetNameInd] intValue]) {
         [streetNameArray removeObjectAtIndex:0];
         }
         }
    
         NSString *streetName=[streetNameArray componentsJoinedByString:@" "];
    
         NSString *streetNumber=@"";
         if ([arr[streetNameInd] intValue]!=0) {
         streetNumber=[NSString stringWithFormat:@"%d", [arr[streetNameInd] intValue]];
         }
    
        NSString *city=arr[cityNameInd];
        // NSLog(@"\nstreet number :%@\nstreet name  :%@\ncity name :%@",streetNumber, streetName,city);
    
        NSArray *addressParts=[NSArray arrayWithObjects:streetNumber, streetName, city, nil];
    
        return addressParts;
    }
    
    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification{
    
        NSString *str1=@"34 Ellis Street, San Francisco";
        NSString *str2=@"4FL, 800 Market Street, San Francisco";
        NSString *str3=@"Ellis & Market, San Francisco";
    
        NSArray *firstAddress=[self brakeAddress:str1];
        NSArray *secondAddress=[self brakeAddress:str2];
        NSArray *thirdAddress=[self brakeAddress:str3];
    
        NSLog(@"\n1st : street number :%@\nstreet name  :%@\ncity name :%@",firstAddress[0],firstAddress[1],firstAddress[2]);
        NSLog(@"\n2nd : street number :%@\nstreet name  :%@\ncity name :%@",secondAddress[0],secondAddress[1],secondAddress[2]);
        NSLog(@"\n3rd : street number :%@\nstreet name  :%@\ncity name :%@",thirdAddress[0],thirdAddress[1],thirdAddress[2]);
    
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three models: class User include Mongoid::Document field :name, :type => String has_many
I have a Long string from that I want to store the keyword in
I have a string containing field/value pairs in xml format and want to parse
I have a list that contain two colums which are type currency. I want
I have a Type, a String and an Object. Is there some way I
Work on asp.net vs05. I have three type of value Like:IsDesign,IsPrinting,IsInstall they are bit
I have a union type of array of three integers (4 bytes each), a
Are there any standalone type conversion libraries? I have a data storage system that
I have a method that needs to retrieve a type of size so for
First off, I want to say that yes, I do know that doing this

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.