title: How to remove whitespace from right end of NSString?
body: <p>This removes white space from both ends of a string:</p>
  
  <pre><code>NSString *newString = [oldString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
  </code></pre>
  
  <p>How do I remove white space from just the right end of a string?</p>
  
  <p>UPDATE: The code from the <a href="https://stackoverflow.com/questions/5689288/how-to-remove-whitespace-from-right-end-of-nsstring/5691567#5691567">accepted answer</a> is now part of <a href="https://github.com/samsoffes/sstoolkit/blob/master/SSToolkit/NSString+SSToolkitAdditions.m#L288-318" rel="nofollow noreferrer">SSToolkit</a>. Yay!</p>