Re: Length of globallyUniqueString
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.