• 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: Length of globallyUniqueString
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Length of globallyUniqueString


  • Subject: Re: Length of globallyUniqueString
  • From: Aram Greenman <email@hidden>
  • Date: Tue, 28 May 2002 20:16:21 -0700

Would some one tell me the longest length of the string produced by:

NSString *tempString = [[NSProcessInfo processInfo] globallyUniqueString];


I am getting 79 characters in length and it still gets longer every time it is executed. I am using it in a database and would like to be sure that the size of the field will be large enough in the future.

Use the CoreFoundation type CFUUIDRef (thanks to someone on this list who pointed this out before). This is a normal 128-bit UUID. You can get its string representation with CFUUIDCreateString(), which is 36 characters, two characters for each byte plus four hyphens, for example, 68753A44-4D6F-1226-9C60-0050E4C00067.

CFUUIDRef u = CFUUIDCreate(NULL);
NSString *s = (NSString *)CFUUIDCreateString(NULL, u); // returns a CFStringRef, which casts to NSString * thanks to toll-free bridge

CFRelease(u);
[s release];

There is also CFUUIDGetBytes() which will give you the raw bytes in a CFUUIDBytes structure.

Aram
_______________________________________________
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: 
 >Re: Length of globallyUniqueString (From: Chris Kane <email@hidden>)

  • Prev by Date: Frontmost window of particular document type
  • Next by Date: NSSize width/height
  • Previous by thread: Re: Length of globallyUniqueString
  • Next by thread: using currentDocument accessors to validateMenuItem
  • Index(es):
    • Date
    • Thread