I have a string "result" it contains for example 30. I want to output this result in TextView1. The problem is that I want my textview to display the result in 4 length format. For example 30 will be 0030 and if the result would be 100 it would display 0100.
What I've done is the following
if(result.length()<4) {
test = 4;
cl = result.length();
cl = test - cl;
}
At the moment the only thing I've done is count the length, and receive how much "0" I have to add, but I'm not sure, what is the right way to add these extra zeros to the final result.
Aucun commentaire:
Enregistrer un commentaire