01

Getting Started with Android Studio
上午同事傳了一個網址給我,點入一看,
是一個新的Android開發工具,
其中有一項功能吸引了我,
也就馬上下載來看看囉!

陳蝴蝶 vs 陳米漿 發表在 痞客邦 留言(0) 人氣()

2012-06-26_14-04-40
1.Processing Text 處理字串
Input: original text 原始字串
Output: edited text 編輯後字串
// neMAp = <span content, span id>
private HashMap neMap = new HashMap();
// neLength = span content length
private ArrayList neLength = new ArrayList();

// get <span> id and content
// replace <span>content</span> to <util>content
// 取得<span>的id和所包的文字內容
// 將<span>文字內容</span>換成<util>content
private String parseContent(String text) {
String[] contArray = text.split("<span id=\"");
ArrayList keyArray = new ArrayList();
for (String ca : contArray) {
String span = ca.split("</span>")[0];
keyArray.add(span);
}
for(int i = 1 ; i < keyArray.size() ; i++){
String[] temp = keyArray.get(i).split("\">");
neMap.put(temp[1], temp[0]);
neLength.add(temp[1].length());
text = text.replace("<span id=\""+temp[0]+"\">"+temp[1]+"</span>", "<util>"+temp[1]);
}
return text;
}

陳蝴蝶 vs 陳米漿 發表在 痞客邦 留言(0) 人氣()

1
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。