alexa
Facebook
Twitter
LinkedIn
Instagram
Whatsapp
Call Now
Quick Inquiry

How to truncate decimal value in a text in android ?

How to truncate decimal value in a text in android ?

try this

 String str = "10.289 Mbps";

String[] strArray = str.split(" ");
    
Long roundedValue = Math.round(Double.valueOf(strArray[0]));
    
String resultStr = roundedValue.toString() + " " + strArray[1];

System.out.println(resultStr);

215 0
7

Write a Comments


* Be the first to Make Comment

GoodFirms Badge
GoodFirms Badge

Fix Your Meeting With Our SEO Consultants in India To Grow Your Business Online