Christian Janev
07/09/2020, 11:10 PMtoBePercent = (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"Daniel Medeiros
07/09/2020, 11:23 PMtoDouble
or
use 100.0Christian Janev
07/09/2020, 11:25 PMdeactivateduser
07/09/2020, 11:36 PMChristian Janev
07/09/2020, 11:39 PMpercentBtn.setOnClickListener {
var toBePercent = text.text.toString().last().toString()
toBePercent = (toBePercent.toFloat() / 100.00).toString()
text.text = toBePercent
}
deactivateduser
07/09/2020, 11:41 PMvar toBePercent = text.text.toString().last().toString()
you seem to be only taking the last digit here.... is that by design?Christian Janev
07/09/2020, 11:41 PMdeactivateduser
07/09/2020, 11:42 PM