You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package com.engine.tjyh.xc.cmd;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* TODO
|
|
|
|
*
|
|
|
|
* @Description
|
|
|
|
* @Author matrix
|
|
|
|
* @Date 2023/8/12 18:15
|
|
|
|
**/
|
|
|
|
public class Test {
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
System.out.println(Ts("85.0"));
|
|
|
|
System.out.println(Ts("85.00"));
|
|
|
|
System.out.println(Ts("0"));
|
|
|
|
System.out.println(Ts(""));
|
|
|
|
System.out.println(Ts("26.0000"));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String Ts(String input) {
|
|
|
|
|
|
|
|
if (input.contains(".")) {
|
|
|
|
String ff = input.substring(input.indexOf("."),input.length());
|
|
|
|
if(ff.length()>2){
|
|
|
|
input = input.substring(0,input.indexOf(".")+3);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return input;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|