隐藏手机号个别位****

import java.util.ArrayList;

import java.util.HashMap;

import java.util.List;

 

 

/**

 * 测试隐藏手机号个别位****

 * @author Laughing_Lz

 * @date 2016年1月4日

 */

public class test {

 

public static void main(String[] args) {

List<HashMap<String,Object>> list = new ArrayList<HashMap<String,Object>>();

HashMap<String,Object> map=new HashMap<String,Object>();

HashMap<String,Object> map1=new HashMap<String,Object>();

map.put("1", "13810112222");

map1.put("2", "18401669999");

list.add(map);

list.add(map1);

String phone = (String) map.get("1");

String phoneheader = phone.substring(0, 3);

String phonefooter = phone.substring(7, 11);

String newphone = phoneheader + "****" + phonefooter;

map.put("1", newphone);

System.out.println(list.toString());

System.out.println(map.get("2"));

}

}

posted @ 2016-01-04 10:38  回看欧洲  阅读(339)  评论(0编辑  收藏  举报