如何去除搅拌周围的支架?当运行数据库查询它的显示括号围绕值时,我从保存在数组字符串中的数据库中获取值我该怎么办?我想去掉stirng [AT] 周围的支架怎么做?
static ArrayList<String> Meal_groupid = new ArrayList<String>();
String formatedString = "[AT]"
.replace("[", "") //remove the right bracket
.replace("]", "");
Log.i("Formating Stirng",""+formatedString);
Meal_groupid.add(mCursor2.getString(mCursor2.getColumnIndex("meal_group_id"))
.replace("[", "").replace("]", ""));
Log.i("MEalGroup ID",""+Meal_groupid);
当在 logcat 中看到
在 logcat 中格式化Stirng AT
MEalGroup ID [AT]
当我运行查询
Cursor mCursor = db.selectQuery("
SELECT m.menu_id, m.title AS menu_title
FROM uss_school_to_menu sm
LEFT JOIN uss_menu m on sm.menu_id = m.menu_id
LEFT JOIN uss_school s on s.school_id = sm.school_id
WHERE s.school_id = '"+ School_ID+"' AND sm.level_id = " +
SchoolLevelId + " AND m.meal_group_code = '"+Meal_groupid.toString()+"'" );
在数据库中它看起来像这样
SELECT m.menu_id, m.title AS menu_title
FROM uss_school_to_menu sm
LEFT JOIN uss_menu m on sm.menu_id = m.menu_id
LEFT JOIN uss_school s on s.school_id = sm.school_id
WHERE s.school_id = '147' AND sm.level_id = 1 AND m.meal_group_code = '[AT]'
我想删除 [AT] 周围的括号