Tell me, pliz, how to replace the format of text data of the form $ 1,900.00 with a numeric one using an sql query?
2 answers
For example, CAST(REPLACE(REPLACE('$1,900.00','$',''),',','') as FLOAT)
|
private static final int DB_VERSION = 2; UPDATE HERE public int getContactsCount() { String countQuery = "SELECT * FROM " + TABLE_SOURCES; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(countQuery, null); int count = cursor.getCount(); cursor.close(); // return count return count; } private Database db = new Database(this); Toast.makeText(this, String.valueOf(db.getContactsCount()), Toast.LENGTH_LONG).show(); share meningkatkan jawaban ini
- Please try to write more detailed answers. I am sure the author of the question would be grateful for your expert commentary on the code above. - Nicolas Chabanovsky ♦
|