Android : Delete all characters after the dot in a string

on Thursday, January 29, 2015


How to delete all the charather/ number after the . in a string


String i = "154.232";


I just want 154


Thanks


My Code:



distance = crntLocation.distanceTo(newLocation) / 1000; // in km

double newKB = Math.floor(distance);

String product_distance = String.valueOf(newKB);

product_distance.replaceAll("\\..*", "");

0 comments:

Post a Comment