+++ /dev/null
-package com.yuji.em.common;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import android.content.Context;
-
-import com.yuji.em.utility.EditPrefUtil;
-
-public class CommonUtil {
- public static String replaceString(String text, String src, String dst) {
- return text.replaceAll(src, dst);
- }
-
- public static String escapeHtml(String text) {
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < text.length(); i++) {
- switch (text.charAt(i)) {
- case '&':
- result.append("&");
- break;
- case '<':
- result.append("<");
- break;
- case '>':
- result.append(">");
- break;
- default:
- result.append(text.charAt(i));
- break;
- }
- }
- return result.toString();
- }
-
- public static boolean isNull(String str){
- return str == null || str.length() == 0;
- }
-
- public static List<String> split(String str, String delm){
- int l = str.length();
- List<String> list = new ArrayList<String>();
-
- int pos = 0;
- String s;
- while (pos < l){
- int n = str.indexOf(delm, pos);
- if (n < 0){
- s = str.substring(pos);
- n = l;
- }
- else {
- s = str.substring(pos, n);
- }
- list.add(s);
- pos = n + 1;
- }
-
- return list;
- }
-
- public static String getUsername(Context context){
- EditPrefUtil pref = new EditPrefUtil(context);
- return pref.get(Constant.PREF_USER);
- }
-
- public static String getPassword(Context context){
- EditPrefUtil pref = new EditPrefUtil(context);
- return pref.get(Constant.PREF_PASSWORD);
- }
-}