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

  • Home
  • SEARCH
  • 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 9147409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T10:58:55+00:00 2026-06-17T10:58:55+00:00

I have an input string in the format Jerry Lane(angle bracket)jerry.lane@gmail.com(bracket closed),Harry Potter(angle bracket)harry.potter@gmail.com(bracket

  • 0

I have an input string in the format

“Jerry Lane”(angle bracket)jerry.lane@gmail.com(bracket closed),”Harry Potter”(angle bracket)harry.potter@gmail.com(bracket closed),”Indiana Jones”,(angle bracket)indiana.jones@gmail.com(bracket closed),”Tom Cruise”(angle bracket)tom.cruise@gmail.com(bracket closed)

Here, i am supposed to first separate the string on the basis of comma delimiter, which would give me a separate string like

“Jerry Lane”(angle bracket)jerry.lane@gmail.com(bracket closed)

Then i need to save extract the string between the <> brackets, which is essentially the string “jerry.lane@gmail.com”. I am using the following code, but it is giving me the following error:

Terminating app due to uncaught exception ‘NSRangeException’, reason: ‘-[__NSCFConstantString substringWithRange:]: Range or index out of bounds’

-(NSArray *)parseString:(NSString *)string
{
  if(string)
  {
    NSArray *myArray = [string componentsSeparatedByString:@","];
    for(NSMutableString *myString in myArray)
    {
        NSRange start,end;
        start = [myString rangeOfString:@"<"];
        end = [myString rangeOfString:@">"];
        if(start.location != NSNotFound && end.location != NSNotFound)
        {
            NSString *emailAddress = [myString substringWithRange:NSMakeRange(start.location,end.location)];
            NSString *name = [myString substringToIndex:start.location];

            NSDictionary *myDictionary = [[NSDictionary alloc] init];
            [myDictionary setValue:emailAddress forKey:@"Dhruvil Vyas"];
            [testArray addObject:myDictionary];

        }
    }
}

return testArray;

}

  • 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-17T10:58:56+00:00Added an answer on June 17, 2026 at 10:58 am

    The arguments that substring takes are the start position and the length

    Not the start position and the end position.

    More Info

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I have the following date as String format. Input 2010-04-20 05:34:58.0 Output I
The input string is '20100908041312' the format is year,month,day,Hours,minutes,seconds,time zone and I have ben
I'm working in Visual Studio 2008. I have a string input in the format
I have an input string of the format abc;def;ghi;jkl;........ and so on. the smallest
I have an input string in the following format: 12.34 When I call this
I have an input string that's generated as in following example: string.Format(Document {0}, was
I have an multiline input string of following format ID | Col1 | Col2
I have an input string. Format is below: This;is;my;long;string Any fast solution (a lot
I have an input string in the following format String input = 00IG356001110002005064007000000; Characters
I have an input string which data is coming in the following format: http://testing/site/name/lists/tasks

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.