title: Remove the last character typed in UItextfield
body: <p>I need to remove the last character if the textfield length exceeds 100,I used the following code:</p>
  
  <pre><code>- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
  {
      if(textfield.text.length&gt;=100)
      {
          NSString *text;
          textField.text=text;
          NSString *newString = [text substringToIndex:[text length]-1];
          textField.text=newString;
      }
      return YES;
  }
  </code></pre>
  
  <p>But it just erases the whole text.</p>