![](/img/trans.png)
[英]I want to add data from my php database into my checkbox how can i do that?
[英]I want to compare the user input from my form to the queried data. but I want it not to be case sensitive. how do I do that?
/ * 假設txtOrigin和txtDestination的值與查詢變量匹配,則將其與 /
if((origin.getText().toString().matches(queryOrigin))
&& (destination.getText().toString().matches(queryDestination)))
{
//proceed to route found layout
Intent openRouteFound = new Intent("com.icommute.feu.RouteFound");
startActivity(openRouteFound);
}
/**compares the values of txtOrigin
and txtDestination to the query
variables assuming it doesn't match*/
else
{
//proceed to no routes found layout
Intent openNoRoute = new Intent("com.icommute.feu.NoRoute");
startActivity(openNoRoute);
}
請嘗試:
if((origin.getText().toString().equalsIgnoreCase(queryOrigin))
&& (destination.getText().toString().equalsIgnoreCase(queryDestination)))
{
...
}
使用.equalsIgnoreCase()方法,例如:
if((origin.getText().toString().equalsIgnoreCase(queryOrigin))
&& (destination.getText().toString().equalsIgnoreCase(queryDestination)))
{
}
嘗試這個
origin.getText().toString().matches("(?i)" + queryOrigin)
。
這將使正則表達式為CASE_INSENSITIVE
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.