public class test {
public static void main(String[] args) {
String a = "2018-01-02";
char[] chars = a.toCharArray();
if(chars[5]=='0'){
chars[5]='-';
}
if(chars[8]=='0'){
chars[8]='-';
}
for(int i=0;i<chars.length-1;i++){
if(chars[i]=='-'){
chars[i] = ' ';
}
}
for(int i=0;i<chars.length;i++){
System.out.print(chars[i]);
}
}
}
今天做了**公司的笔试题,我好菜哦,输出格式不对不得分啊,可是我写了好久才将这个格式转化
以后做一个爱写博客的少年