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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:43:52+00:00 2026-06-10T09:43:52+00:00

I have an NSRange and need to break a string into two substrings on

  • 0

I have an NSRange and need to break a string into two substrings on either side of this NSRange. How do I get an integer value (like the index) out of an NSRange?

  • 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-10T09:43:54+00:00Added an answer on June 10, 2026 at 9:43 am

    NSRange struct consists of two integers – the location and the length.

    typedef struct _NSRange {
        NSUInteger location;
        NSUInteger length;
    } NSRange;
    

    It looks like location and location+length are the two expressions that you are looking for – the ranges for the left and right substring are as follows:

    NSRange prefixRange = NSMakeRange(0, myRange.location);
    NSUInteger pos =myRange.location+myRange.length;
    NSRange suffixRange = NSMakeRange(pos, myString.length - pos);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like: 1 this is my first text 2 his is
I need to convert a formated data to struct like this: struct header {
I have a UIWebView with static textual content and need to get the rect
I need to search the index of a string from NSMutableArray . I have
I have a string with certain pattern. I need to search for the pattern
I have two UITextfields. First UITextfield - Minimum value = 1 and maximum value
I have a NSString which is a URL. This URL need to be cut:
I have a string: He said hello mate yesterday. I want to get an
I don't know how I should do this, I have tried using code like:
I have an issue with NSRange that is causing my app to crash when

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.