title: remove last chars from NSString
body: <p>I have a <code>NSString</code> and for the life of me I cannot figure out how to <code>remove spaces</code> and then take the <code>last 30 characters</code> of it.</p>
  
  <p>Errors like:</p>
  
  <p><code>3/5/13 3:38:30 PM *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType UTF8String]: unrecognized selector sent to instance 0x160bf20'</code></p>
  
  <p>or </p>
  
  <p><code>3/5/13 3:30:51 PM *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType length]: unrecognized selector sent to instance 0x160bf20'</code></p>
  
  <p>I dont understand these errors. </p>
  
  <p>Code:</p>
  
  <pre><code>NSString* m = (NSString*)CFDictionaryGetValue(diskDesc, kDADiskDescriptionVolumeUUIDKey);
  [m stringByReplacingOccurrencesOfString:@" " withString:@""]    
  NSString *newString = [m substringToIndex:[m length]-30];
  </code></pre>
  
  <p>Another Update:</p>
  
  <pre><code>NSString * m = (NSString*)CFDictionaryGetValue(diskDesc, kDADiskDescriptionDeviceModelKey);
  NSString * v = (NSString*)CFDictionaryGetValue(diskDesc, kDADiskDescriptionVolumeUUIDKey);
  
  if(m)
  {
      m = [m stringByReplacingOccurrencesOfString:@" " withString:@""];
  }
  
  if(v)
  {
      if([v length] &gt; 30)
      {
          NSString *newString = [v substringToIndex:[v length]-30];
      }
  }
  </code></pre>