title: How to limit textfield decimal
body: <p>How to limit the lenght of several UItextField in this way:</p>
  
  <p>Max integer allowed two and max decimal allowed one.</p>
  
  <p>I've used this code to limit the text to two number:</p>
  
  <pre><code>func textField(textField: UITextField, shouldChangeCharactersInRange range: NSRange, replacementString string: String) -&gt; Bool {
  
  var kMaxLength = 2
  let oldString = textFieldlOne.text as NSString
  
  let string = oldString.stringByReplacingCharactersInRange(range, withString: string)
  
  
  return countElements(string) &lt;= kMaxLength
  
   }
  </code></pre>
  
  <p>But I have several UITextfield IBOutlet and I want allow the user to insert one decimal number es. 12.5 </p>