• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ASCII to hexa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ASCII to hexa


  • Subject: Re: ASCII to hexa
  • From: Fritz Anderson <email@hidden>
  • Date: Thu, 24 Jul 2003 09:47:15 -0500

First, the characters in an NSString are Unicode, not ASCII. If you need ASCII, you will have to convert them by creating a C string with one of NSString's methods lossyCString, dataUsingEncoding: NSASCIIStringEncoding, or dataUsingEncoding: NSASCIIStringEncoding allowLossyConversion: YES. Read the documentation on NSData to see how to access the length and bytes of an NSData object.

If the Unicode characters are good enough for you, you can obtain them through characterAtIndex:. You can then format them as hexadecimal with [NSString stringUsingFormat: @"x", character].

-- F

On Thursday, 24 July 2003, at 4:46 AM, Julien Michel Palmas wrote:

I would like to convert NSString to hexadecimal number.
for example :
E --> 45

how should i do ??

--
Fritz Anderson - Consulting Programmer - Chicago, IL
Mail: <email@hidden>
Risumi: <http://resume.manoverboard.org>
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >ASCII to hexa (From: Julien Michel Palmas <email@hidden>)

  • Prev by Date: Re: Bug reports and documentation updates
  • Next by Date: Memory Full or not
  • Previous by thread: ASCII to hexa
  • Next by thread: Re: Design for Cocoa (was Re: Can a subclass of NSDictionary do this?)
  • Index(es):
    • Date
    • Thread