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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:23:35+00:00 2026-05-26T07:23:35+00:00

I currently have an NSString containing hex values. I need to convert this NSString

  • 0

I currently have an NSString containing hex values. I need to convert this NSString object into an NSData object, without changing its contents at all.

  • 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-26T07:23:36+00:00Added an answer on May 26, 2026 at 7:23 am

    I use this code to “parse” the debug output of an NSData object (what you get in the console if you just NSLog an NSData object) back into NSData:

    -(NSData*) bytesFromHexString:(NSString *)aString;
    {
        NSString *theString = [[aString componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] componentsJoinedByString:nil];
    
        NSMutableData* data = [NSMutableData data];
        int idx;
        for (idx = 0; idx+2 <= theString.length; idx+=2) {
            NSRange range = NSMakeRange(idx, 2);
            NSString* hexStr = [theString substringWithRange:range];
            NSScanner* scanner = [NSScanner scannerWithString:hexStr];
            unsigned int intValue;
            if ([scanner scanHexInt:&intValue])
                [data appendBytes:&intValue length:1];
        }
        return data;
    }
    

    It’s not my most robust code, but it does the job of parsing [nsdata_object description].

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

Sidebar

Related Questions

I currently have this code: UIImage *image = [[UIImage alloc] initWithContentsOfFile:[imagesPath stringByAppendingPathComponent:[NSString stringWithFormat:@/%@.png, [postsArrayID
We currently have code like this: Dim xDoc = XDocument.Load(myXMLFilePath) The only way we
I currently have two UITextFields inside two corresponding UITableViewCells. This is how it looks:
I have a this code : NSString *url = [NSString stringWithFormat:@tt://classObj?title=%@, obl.title]; TTTableImageItem *cell
This is what i currently have to display my text, but i can't seem
I have a comprehension question. This method is given: - (NSArray*)test { NSData *data
I currently have an NSString that contains 03/23/2011. I would like to check to
I currently have the following code: -(void) inputNumber:(int)number { NSString *str; str = [NSString
I currently have a loop which iterates through an NSArray of NSString objects. I
I currently have this code but it leaks because I don't know how to

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.