Sunday, May 15, 2011

NSString hash example objc

A NSString:hash example is shown below. The NSString:hash function returns an unsigned integer value that is computed from the characters of the string.
[NSString:hash example]

#import <Cocoa/Cocoa.h>

int   main()
{
    NSAutoreleasePool    *pool = [NSAutoreleasePool  new];
   
    NSString   *m = [NSString stringWthString: @"Abcdefg"];
    
    NSLog(@"Hash: %d", [m hash]);
    NSLog(@"Hash: %d", [m hash]);
   
    [pool release];
}