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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:48:14+00:00 2026-05-25T18:48:14+00:00

All I am looking to format a guid stored in an NSString with hyphens?

  • 0

All

I am looking to format a guid stored in an NSString with hyphens? I would like to avoid substrings and use a formatter if possible

so
D21AB2C8-E61F-11E0-ADEE-20D04824019B

instead of
D21AB2C8E61F11E0ADEE20D04824019B

The value is already in an NSString and I just need to add the hyphens, but I would rather not have to deal with parsing the String and inserting hyphens with substrings.

Any thoughts?

Thanks!

  • 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-25T18:48:14+00:00Added an answer on May 25, 2026 at 6:48 pm

    Not sure why you are against parsing, but if you are so dead set against it then use an NSMutableString and insert your hyphens at the appropriate index.

    NSMutableString * guid = [NSMutableString stringWithString: @"D21AB2C8E61F11E0ADEE20D04824019B"];
    [guid insertString: @"-" atIndex: 8];
    [guid insertString: @"-" atIndex: 13];
    [guid insertString: @"-" atIndex: 18];
    [guid insertString: @"-" atIndex: 23];
    
    NSLog(@"GUID: %@", guid);
    

    For the record, I think its better to use NSString’s stringWithFormat and substrings, but to each his own.

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

Sidebar

Related Questions

I'm looking for all the current standard header values a web server would generally
Looking to get a list of all the files (commit comments would be nice
I'm looking to put an image that's in base64 format and that's stored in
I'm looking for a convenient way to use jQuery to remove all classes from
I'm looking to match all text in the format foo:12345 that is not contained
I may be looking at this all wrong. But, I am trying to use
Looking at the DateTimeFormatInfo documentation, it appears that all the standard formats have colons
I've been looking all over the internet for a solution to the following error;
I've been looking all over for a simple example of how to have an
So, I've been looking all over. I can't find anywhere that talks about specifically

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.