日期:2014-05-20 浏览次数:20833 次
String s="sj3jsjs@hotmail.com";
String ss=s.substring(0, s.lastIndexOf("@")).replaceAll("", ".");
String sss=s.substring(s.lastIndexOf("@"), s.length());
String ssss=ss.substring(1,ss.length()-1);
System.out.println(ssss+sss);
String str = ".sj3jsjs@hotmail.com";
String strStart = str.split("@")[0];
char[] chars = strStart.toCharArray();
StringBuffer sb = new StringBuffer();
for(int i=0;i<chars.length;i++){
String s = String.valueOf(chars[i]);
if(s.equals(".")&&(i==0)){
sb.append("");
}else{
sb.append(s+".");
}
}
sb.append("@");
sb.append(str.split("@")[1]);
System.out.println(sb.toString());