```toBePercent = (toBePercent.toFloat() / 100).toS...
# getting-started
c
Copy code
toBePercent = (toBePercent.toFloat() / 100).toString()
I have this line of code and whenever I make toBePercent into 5 it converts it to "0.05" (good) but whenever I make toBePercent into 10 or above it outputs "0.0"
d
Maybe try:
toDouble
or use 100.0
c
I tried toDouble and 100.0 doesn't work
d
hrm, you have the sample code? it works fine here https://pl.kotl.in/crYCWYv6B
c
Maybe it's since I'm using android studio?
Copy code
percentBtn.setOnClickListener {
            var toBePercent = text.text.toString().last().toString()
            toBePercent = (toBePercent.toFloat() / 100.00).toString()
            text.text = toBePercent
        }
d
Copy code
var toBePercent = text.text.toString().last().toString()
you seem to be only taking the last digit here.... is that by design?
c
Just saw tjat
It works now
d
👍