title: Swift: How to remove last character
body: <p>I am doing an app with eureka forms (costum rows) and the problem is that when i want to calculate firstValue with percentageField dosen't calculate correct because when i try to convert to double can't convert % in double ex: <br>
  firstValue = 34<br>
  percentageField = 9%<br>
  Problem is that "9%" can't convert to double and the value is 0<br>
  percentageField*firstValue = 0 because cant convert %</p>
  
  <p>Code : </p>
  
  <pre><code>func eingabessumeBruttoCalc(forPercentage isPercentage: Bool){
          let rowEingabessumeBrutto: KalkulationRow = (formViewController()?.form.rowBy(tag:"eingabessumeBrutto"))!
         let rowRabatt: KalkulationRow = (formViewController()?.form.rowBy(tag:"rabatt"))!
          let rowSkonto: KalkulationRow = (formViewController()?.form.rowBy(tag:"skonto"))!
          let rowDiverse: KalkulationRow = (formViewController()?.form.rowBy(tag:"diverse"))!
          let rowZielBrutto:KalkulationRow = (formViewController()?.form.rowBy(tag:"zielBrutto"))!
          let rowZielNetto:KalkulationRow = (formViewController()?.form.rowBy(tag:"zielNetto"))!
          let rowEingabessumeNetto:KalkulationRow = (formViewController()?.form.rowBy(tag:"result"))!
  
          let ValueEingabessumeBrutto = Double(rowEingabessumeBrutto.cell.valueField.text ?? "") ?? 00
          let ValueEingabessumeNetto = Double(rowEingabessumeNetto.cell.valueField.text ?? "") ?? 00
  
  
          let ValueZielBrutto = Double(rowZielBrutto.cell.percentageField.text ?? "")  ?? 00
          let totalZielBrutto = ValueEingabessumeBrutto * ValueZielBrutto * 0.01
          rowZielBrutto.cell.valueField.text = total.description
  
          let ValueRabatt = Double(rowRabatt.cell.percentageField.text ?? "")  ?? 00
          let totalRabatt = ValueEingabessumeBrutto * ValueRabatt * 0.01
          rowRabatt.cell.valueField.text = total.description
  
          let SkontoValue = Double(rowSkonto.cell.percentageField.text ?? "")  ?? 00
          let rowsSkonto = Double(rowEingabessumeBrutto)-Double(rowRabatt)
          let totalSkonto = rowSkonto * SkontoValue * 0.01
          rowSkonto.cell.valueField.text = total.description
  
          let ValueDiverse = Double(rowDiverse.cell.percentageField.text ?? "")  ?? 00
          let totalDierse = ValueEingabessumeBrutto * ValueDiverse * 0.01
          rowDiverse.cell.valueField.text = total.description
  
          let ValueZielNetto = Double(rowZielNetto.cell.percentageField.text ?? "")  ?? 00
          let totalDierse = ValueEingabessumeNetto * ValueZielNetto * 0.01
          rowZielNetto.cell.valueField.text = total.description
  </code></pre>
  
  <blockquote>
  <pre><code>      if let text = percentageField.text,
              !text.isEmpty {
              percentageField.text?.removeLast()
  
          }
  </code></pre>
    
    <p>This is what i try.</p>
  </blockquote>
  
  <p>I want to check if the last character is % remove it.</p>