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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:36:44+00:00 2026-05-25T13:36:44+00:00

Take for example NSURL *url = [NSURL URLWithString:@eg://resources/users/1/answers/2]; NSLog(@%@, [url pathComponents]); >> ( /,

  • 0

Take for example

NSURL *url = [NSURL URLWithString:@"eg://resources/users/1/answers/2"];
NSLog(@"%@", [url pathComponents]);

>> ( "/", "users", "a", "answers", "b" )

1) Why does the path contain a “/”?

2) If what I want is the “users”, is it safe to use the first index?

[[url pathComponents] objectAtIndex:1];
  • 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-25T13:36:44+00:00Added an answer on May 25, 2026 at 1:36 pm

    (1) In this case the “/” is the root directory. The other slashes between directories in the path are just separators but the root folder is significant. “users/1/answers/2” may refer to a different location than “/users/1/answers/2”, the former is relative to the current directory and the latter always starts at the root folder.

    (2) Yes, if the URL is an absolute URL, not for a relative URL. But you can get the absolute URL with the absoluteURL method first and then get the components. Although, what if the URL was just “http://www.example.com/”, all you would get is (“/”) and that’s it, no subdirectory.

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

Sidebar

Related Questions

Take the example classes below. I want to display the customer and two addresses
Take for example an application which has users, each of which can be in
Take for example this code . So, instead of the <a> tag I want
Regex fun again... Take for example http://something.com/en/page I want to test for an exact
I want to minimize javascript in C#. Take for example this javascript I found
How to get the relative path in t sql? Take for example a .sql
Take the example: $.ajax({lhs:val}); What does the {} do? As far as I know,
Let's take example of a command example-command. I open terminal I write example-command in
Take this example code (ignore it being horribly inefficient for the moment) let listToString
Take for example the following regex match. preg_match('!^publisher/([A-Za-z0-9\-\_]+)/([0-9]+)/([0-9]{4})-(january|february|march|april|may|june|july|august|september|october|november|december):([0-9]{1,2})-([0-9]{1,2})/([A-Za-z0-9\-\_]+)/([0-9]+)(/page-[0-9]+)?$!', 'publisher/news/1/2010-march:03-23/test_title/1/page-1', $matches); print_r($matches); It produces the

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.