小编Why*_*sMe的帖子

如何从 Kotlin 中的数字中删除小数部分?

我正在将OpenWeatherMapsAPI 用于天气应用程序,但它在某些城市显示小数,如何从中删除小数部分?

override fun onPostExecute(result: String?) {
            super.onPostExecute(result)
            try {
                val jsonObj = JSONObject(result)
                val main = jsonObj.getJSONObject("main")
                val temp = main.getString("temp")+"°C"
                findViewById<TextView>(R.id.temp).text = temp
Run Code Online (Sandbox Code Playgroud)

android kotlin

2
推荐指数
1
解决办法
2906
查看次数

标签 统计

android ×1

kotlin ×1