接手一个烫手的山芋,数据保存这么写的,纠结要不要改,貌似也没什么太大问题,就是有些特殊字符就…
資深大佬 : gaoshiba 3
class test{ private static final String user_path = "D:\a_user1\"; private static String GetUserName() { File[] list = new File(user_path + "username").listFiles(); if (list != null && list.length >= 1) { return list[0].getName(); } return null; } private static void SetUserName(String UserName) { File[] list = new File(user_path + "username/").listFiles(); if (list != null && list.length >= 1) for (File temp : list) { temp.delete(); } new File(user_path + "username/" + UserName).mkdirs(); } public static void main(String[] args) { System.out.println(GetUserName()); SetUserName("卢四六"); } }
大佬有話說 (4)