語法:
import java.util.Arrays;
public class Slime {
public static void main(String[] args) {
String str1 = "uucp:x:12:14:Adrian W. Jones/OFFICE_01/TEL_NUM_01";
String str2 = "operator:x:13:0:Dorothy Gale/OFFICE_02/TEL_NUM_02";
String str3 = "games:x:12:140:John Hancock/OFFICE_03/TEL_NUM_03";
str1 = str1.substring(str1.lastIndexOf(":")+1,str1.length()).replaceAll("/", "\t");
str2 = str2.substring(str2.lastIndexOf(":")+1,str2.length()).replaceAll("/", "\t");
str3 = str3.substring(str3.lastIndexOf(":")+1,str3.length()).replaceAll("/", "\t");
String[] str = {str1,str2,str3};
Arrays.sort(str);
for(int i=0;i<3;i++)
System.out.println(str[i]);
}
}
名字沒有多加處理
看不太懂 rule
不過那個也不難 加一個 method
call一下 大概多兩三行而已