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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T03:27:52+00:00 2026-05-23T03:27:52+00:00

Possible Duplicate: How to find and replace symbols in a string? Sorry if the

  • 0

Possible Duplicate:
How to find and replace symbols in a string?

Sorry if the following is really obvious, but I’m just starting to work with NSRange and found the docs not really helpful with my question.

I have a string and I would like to look through it, starting from the very end. I would like to determine the range from the end of the string to either (1) the first space OR (2) the first return.

This is what I have so far:

 NSRange range = [myString rangeOfString:@" " options:NSBackwardsSearch];

but how do I tell objective-C something like rangeOfString:@" " or @"/n"?

Thanks for any help or suggestions with 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-05-23T03:27:52+00:00Added an answer on May 23, 2026 at 3:27 am

    You can do something like this:

    NSRange rangeSpace = [myString rangeOfString:@" " options:NSBackwardsSearch];
    NSRange rangeReturn = [myString rangeOfString:@"/n" options:NSBackwardsSearch];
    
        if(rangeSpace.location < rangeReturn.location)
            //use rangeReturn
        else
            //use rangeSpace
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Using Emacs to recursively find and replace in text files not already
Possible Duplicate: How to find whether a string contains any of the special characters?
Possible Duplicate: Where can I find a web-project “security checklist?” i was just wondering
Possible Duplicate: Find last character in a string in PHP How can I know
Possible Duplicate: PHP: Replace umlauts with closest 7-bit ASCII equivalent in an UTF-8 string
You might find this question to be a possible duplicate of the following: Does
Possible Duplicate: Where do I find the current C or C++ standard documents? I
Possible Duplicate: How can I find the method that called the current method? I
Possible Duplicate: How do I find out which DOM element has the focus? Is
Possible Duplicate: C#/.NET analysis tool to find race conditions/deadlocks I am debugging an application

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.