java和安卓开发,从日期字符串中提取数字,判断单双号的一种方法
// private void times() {
// String s_time = tv_time.getText().toString().trim();
// int[] s = new int[11];//给下面的循环界限保持一致,不然数组越界
// if (s_time != null && !"".equals(s_time)) {
// for (int i = 0; i < s_time.length(); i++) {
// if (s_time.charAt(i) >= 0 && s_time.charAt(i) <=9) {
// s[i]= Integer.valueOf(s_time.charAt(i));
// }
// }
//
// }
// if (s[7] % 2 == 0) {//例如20190811,获取最后一个数字,判断奇偶就可以了
// s_v1.setChecked(false);
// s_v3.setChecked(false);
// tv_xianhao.setText("双号出行车辆:2");
// } else {
// tv_xianhao.setText("单号出行车辆:1、3");
// s_v2.setChecked(false);
// }
// }