我的文本框有问题。问题是我初始化了属性
textBox1.RightToLeft = RightToLeft.Yes;
当我输入阿拉伯字符时,它输入正确,但如果输入以下内容则会出现问题 字符串
> /之后的数字96,但是编辑器不允许这样写,所以当我读它时它改变了它的字符:66 /جح/
96
جح/ 66/96
答案 0 :(得分:0)
public class DbHelper extends SQLiteOpenHelper {
private static final int DATABASE_VERSION = 1;
private static final String DATABASE_NAME = "triviaQuiz";
private static final String TABLE_QUEST = "quest";
private static final String KEY_ID = "id";
private static final String KEY_QUES = "question";
private static final String KEY_ANSWER = "answer"; //correct option
private static final String KEY_OPTA= "opta"; //option a
private static final String KEY_OPTB= "optb"; //option b
private static final String KEY_OPTC= "optc"; //option c
private SQLiteDatabase dbase;
public DbHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
@Override
public void onCreate(SQLiteDatabase db) {
dbase=db;
String sql = "CREATE TABLE IF NOT EXISTS " + TABLE_QUEST + " ( "
+ KEY_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_QUES
+ " TEXT, " + KEY_ANSWER+ " TEXT, "+KEY_OPTA +" TEXT, "
+KEY_OPTB +" TEXT, "+KEY_OPTC+" TEXT)";
db.execSQL(sql);
addQuestions();
//db.close();
}
private void addQuestions()
{
Question q1 = new Question("Q1?", "Ans A", "" +
"Ans B", "Ans C", "Ans A");
this.addQuestion(q1);
Question q2 = new Question("Q2?", "Ans A", "" +
"Ans B", "Ans C", "Ans C");
this.addQuestion(q2);
Question q3 = new Question("Q3?", "Ans A", "" +
"Ans B", "Ans C", "Ans B");
this.addQuestion(q3);
Question q4 = new Question("What does q4 do?", "Ans A", "" +
"Ans B", "Ans C", "Ans C");
this.addQuestion(q4);
Question q5 = new Question("What does q5 do?", "Ans A", "" +
"Ans B", "Ans C", "Ans B");
this.addQuestion(q5);
}
// Adding new question
public void addQuestion(Question quest) {
//SQLiteDatabase db = this.getWritableDatabase();
ContentValues values = new ContentValues();
values.put(KEY_QUES, quest.getQUESTION());
values.put(KEY_ANSWER, quest.getANSWER());
values.put(KEY_OPTA, quest.getAnsA());
values.put(KEY_OPTB, quest.getAnsB());
values.put(KEY_OPTC, quest.getAnsC());
// Inserting Row
dbase.insert(TABLE_QUEST, null, values);
}
public List<Question> getAllQuestions() {
List<Question> quesList = new ArrayList<Question>();
// Select All Query
String selectQuery = "SELECT * FROM " + TABLE_QUEST;
dbase=this.getReadableDatabase();
Cursor cursor = dbase.rawQuery(selectQuery, null);
// looping through all rows and adding to list
if (cursor.moveToFirst()) {
do {
Question quest = new Question();
quest.setID(cursor.getInt(0));
quest.setQUESTION(cursor.getString(1));
quest.setANSWER(cursor.getString(2));
quest.setAnsA(cursor.getString(3));
quest.setAnsB(cursor.getString(4));
quest.setAnsC(cursor.getString(5));
quesList.add(quest);
} while (cursor.moveToNext());
}
// return quest list
return quesList;
}
public int rowcount()
{
int row=0;
String selectQuery = "SELECT * FROM " + TABLE_QUEST;
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery(selectQuery, null);
row=cursor.getCount();
return row;
}
}
结果:
var LRM = ((char)0x200E).ToString();
lbldate.Text = ddlTrnNoYears.SelectedItem.Text+'/' + LRM + ddlTrainingMonth.SelectedItem.Text + LRM +'/'+ddlTrainingDay.SelectedItem.Text;