title: I can't save a string value into StringBuilder variable on my calcaultor app
body: <p>i been working on an calcaultor app i managed to finish all the buttons but the backspace button ain't working, everytime i try it basically it deletes the numbers from the textView and it doesn't save it true value for example if i hit 9 button 3 times which would give me &quot;999&quot; as a result and then i hit the backspace button it should be &quot;99&quot; and that what actually happens it applies to the textView only
  so if i try multiplying &quot;99&quot; to &quot;1&quot; after using my backspace which was &quot;999&quot; the result that actually was given is &quot;999&quot; which is wrong cuz &quot;99&quot; * &quot;1&quot; = &quot;99&quot;</p>
  <p>My here is part of my mainActivity's code:</p>
  <pre><code>package com.example.newcal
  
  import androidx.appcompat.app.AppCompatActivity
  import android.os.Bundle
  import android.text.TextUtils.substring
  import android.view.View
  import android.widget.Button
  import android.widget.TextView
  import java.lang.IllegalArgumentException
  import java.util.*
  import kotlin.collections.ArrayList
  import kotlin.math.absoluteValue
  
  
  class MainActivity : AppCompatActivity() {
      private var strNumber = StringBuilder()
      private lateinit var tvDisplay: TextView
      private lateinit var button1: Button
      private lateinit var button2: Button
      private lateinit var button3: Button
      private lateinit var button4: Button
      private lateinit var button5: Button
      private lateinit var button6: Button
      private lateinit var button7: Button
      private lateinit var button8: Button
      private lateinit var button9: Button
      private lateinit var buttonClear: Button
      private lateinit var buttonDot: Button
      private lateinit var buttonZero: Button
      private lateinit var buttonDivide: Button
      private lateinit var buttonMultiply: Button
      private lateinit var buttonSubtract: Button
      private lateinit var buttonAdd: Button
      private lateinit var buttonEquals: Button
      private lateinit var buttonBack: Button
      private lateinit var operatorButtons: List&lt;Button&gt;
      private lateinit var numbButtons: Array&lt;Button&gt;
      private var operator: Operator = Operator.NONE
      private var isOperatorClicked: Boolean = false
      private var no1: Double = 0.0
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
  
          components()
  
          strNumber.append(0.0)
          tvDisplay.text = strNumber
          isOperatorClicked = true
  
          for (i in operatorButtons){i.setOnClickListener { operatorButtonClicked(i) }}
          for (i in numbButtons){i.setOnClickListener { numbButtonsClicked(i) }}
          buttonEquals.setOnClickListener { buttonEqualsClicked() }
          buttonClear.setOnClickListener { btnClickedClear() }
          buttonBack.setOnClickListener { btnClickedBack() }
  
      }
  
  private fun buttonEqualsClicked() {
          val no2 = strNumber.toString().toDouble()
          val result: Double
              if (isOperatorClicked == false){
                  when(operator){
                      Operator.ADD -&gt; result = no1 + no2
                      Operator.SUB -&gt; result = no1 - no2
                      Operator.DIV -&gt; result = no1 / no2
                      Operator.MUL -&gt; result = no1 * no2
                      Operator.NONE -&gt; result = 0.0
                  }
                  strNumber.clear()
                  strNumber.append(result.toString())
                  tvDisplay.text = strNumber
                  isOperatorClicked = true
              }
  
          }
  
   private fun btnClickedBack() {
          var str = tvDisplay.text.toString()
          if (str.length &gt; 1) {
              str = str.substring(0, str.length - 1)
              tvDisplay.text = str
  
              }
          if (str.length &lt;= 1){
              val st = strNumber.append(btnClickedClear().substring(0, strNumber.length -3))
              tvDisplay.text = st
          }
  
      }
  
  enum class Operator{ADD, SUB, DIV, MUL, NONE}
  
  </code></pre>
  <p>and here is some screenshots for a better view</p>
  <p><a href="https://imgur.com/a/glhCP0f" rel="nofollow noreferrer">https://imgur.com/a/glhCP0f</a></p>