DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> 字符串:字符串“6sabcsssfsfs33”,掉字符“ab3”
字符串:字符串“6sabcsssfsfs33”,掉字符“ab3”
編輯:CSS詳解     
public class GoodCode {
//假如有字符串“6sabCSSsfsfs33” ,
//用最有快速的方法去掉字符“ab3”,不能用Java內置字符串方法(indeOf,substring,replaceAll等)?
public void isGood() {
String str = "6sabCSSsfsfs33";
char c1 = 'a';
char c2 = 'b';
char c3 = '3';
char[] c = str.toCharArray();
StringBuilder sl = new StringBuilder();
for (char temp : c) {
if (temp != c1 && temp != c2 && temp != c3)
sl.append(temp);
}
System.out.println(sl.toString());
}
public static void main(String[] args) {
GoodCode g = new GoodCode();
g.isGood();
}
} 本文鏈接http://www.cxybl.com/html/wyzz/CSS/20130310/37033.Html
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved