###############################################################

contents = myDB.repWord(contents, "&", "&amt;");
contents = myDB.repWord(contents, "<", "&lt");
contents = myDB.repWord(contents, ">", "&gt");
contents = myDB.repWord(contents, " ", "&nbsp");
contents = myDB.repWord(contents, "\"", "&quot");
contents = myDB.repWord(contents, "\n", "<br>");

###############################################################

public String repWord(String buffer, String OldWord, String NewWord) {
int sp = 0;
int ep = 0;

while (ep <= buffer.length()) {
ep = buffer.indexOf(OldWord, sp);
sp = ep + NewWord.length();

if (ep == -1)
break;
buffer = buffer.substring(0, ep) + NewWord + buffer.substring(ep + OldWord.length());
}
return buffer;
}

'Android > Tip&Tech' 카테고리의 다른 글

제로보드  (0) 2012.09.21
3개 길이의 ExpandableListView  (2) 2012.09.21
안드로이드 관련 아이콘 이미지 모음집  (0) 2012.09.13
android actionbar 고급 팁 모음  (3) 2012.09.12
웹접근성 관련 링크  (0) 2012.08.24

+ Recent posts