I am reading a text file and from that I am inserting a value suppose ID=1s001(String) in the data base. And I am again reading files but this time I want to make sure that I read files if the ID is different in these file, for that I am reterving value from db and comparing with current ID.
Like this Id (from deb). equals (current ID)
But unfortunatily even if the ID=1s001 equals method returns false.
only thing I was able to find is that currentID.length=6 & Id (from deb).length is returning 5. I don't know what is causing this? any Idea?
Actual Code:
Cursor cursor = database.query(StorageDataBase, allColumns,
null, null, null, null, null);
int count = cursor.getCount();
if(count>0){
if(cursor.moveToFirst())
{
String slsManCode=cursor.getString(cursor.getColumnIndex("sales_man_id"));
System.out.println(slsManCode.length()+" "+salesManCode.length());
boolean is=slsManCode.trim().equals(salesManCode.trim());
if(slsManCode.contains(salesManCode))
{
return true;
}
Every coloumn in db is text.
我已经知道是什么原因造成的,实际上这是一个编码问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.