title: Remove Characters and Everything After from String
body: <p>I am aware of replacing Strings of a String, but that only works if I know exactly what I want to remove.</p>
  
  <p>If I have a String like the following:</p>
  
  <p>"hi-there-this-is-a-test&amp;feature=hi-there"</p>
  
  <p>How do I remove '&amp;feature' and everything that comes after that?</p>
  
  <p>Any help would be greatly appreciated. Thanks in advance!</p>
  
  <p>EDIT: If absolutely necessary to use REGEX, could someone show me how to use it? I am aware it is 10.7 onwards but I'm fine with that. Even better, an example of String trimming or using the NSScanner?</p>
  
  <p>Thanks again everyone.</p>
  
  <p>EDIT: The solution posted below is the correct one, but resulted in a crash for me. This is how I solved the problem:</p>
  
  <pre><code>NSString *newString = [[oldString componentsSeparatedByString: @"&amp;feature="] objectAtIndex:0];
  </code></pre>