How do I remove the end of an NSMutableString?

cocoa-touch, ios, iphone, objective-c, xcode

Solution

NSMutableString *string = [NSMutableString stringWithString:@"1*2*3*4*5"];
NSRange range = [string rangeOfString:@"*"];
if (range.location != NSNotFound)
{
    [string deleteCharactersInRange:NSMakeRange(range.location, [string length] - range.location)];
}

Problem

I have the following `NSMutableString`: ``` @"1*2*3*4*5" ``` I want to find the first * and remove everything after it, so my `string = @"1";` How do I do this?

Original source