Update
This commit is contained in:
1 parent
301f96e575
commit
e77b7b4350
4 files changed
+14
-16
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -15,22 +15,19 @@ public class DateFormatOutput {
|
||||
String yearStr = "";
|
||||
String monthStr = "";
|
||||
String dateStr = "";
|
||||
for (int i = 0; i < arr[0].length(); i++) {
|
||||
for (int i = 0; i < arr[0].length(); i++)
|
||||
yearStr += num[arr[0].charAt(i) - '0'];
|
||||
}
|
||||
yearStr += "年";
|
||||
if (month < 10) {
|
||||
if (month < 10)
|
||||
monthStr = num[month] + "月";
|
||||
} else {
|
||||
else
|
||||
monthStr = "十" + num[month % 10] + "月";
|
||||
}
|
||||
if (date < 10) {
|
||||
if (date < 10)
|
||||
dateStr = num[date] + "日";
|
||||
} else if (date < 20) {
|
||||
else if (date < 20)
|
||||
dateStr = "十" + num[date % 10] + "日";
|
||||
} else {
|
||||
else
|
||||
dateStr = num[date / 10] + "十" + num[date % 10] + "日";
|
||||
}
|
||||
System.out.println(yearStr + monthStr + dateStr);
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,14 @@ public class StringInitialization {
|
||||
public static void main(String[] var0) {
|
||||
Scanner sc = new Scanner(System.in);
|
||||
String s = sc.nextLine();
|
||||
StringBuffer sb = new StringBuffer(s);
|
||||
sb.setCharAt(0, Character.toUpperCase(sb.charAt(0)));
|
||||
for (int i = 1; i < s.length(); ++i)
|
||||
if (s.charAt(i - 1) != ',' && s.charAt(i - 1) != ' ')
|
||||
sb.setCharAt(i, Character.toLowerCase(sb.charAt(i)));
|
||||
char[] c = s.toCharArray();
|
||||
c[0] = Character.toUpperCase(c[0]);
|
||||
for (int i = 1; i < c.length; i++) {
|
||||
if (c[i - 1] != ',' && c[i - 1] != ' ')
|
||||
c[i] = Character.toLowerCase(c[i]);
|
||||
else
|
||||
sb.setCharAt(i, Character.toUpperCase(sb.charAt(i)));
|
||||
System.out.println(sb);
|
||||
c[i] = Character.toUpperCase(c[i]);
|
||||
}
|
||||
System.out.println(new String(c));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user