2
我想在Android Java中验证此NIC编号。在Java中不匹配的字符串模式
NICs=NIC.getText().toString();
if((nameS.equals("")||NICs.equals(""))||!(NICs.matches("/^[0-9]{9}[vVxX]$/")))
{
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(
this);
// set title
alertDialogBuilder.setTitle("Warning!");
// set dialog message
alertDialogBuilder
.setMessage("Please fill the above feilds !")
.setCancelable(false)
.setNegativeButton("OK",new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,int id) {
// if this button is clicked, just close
// the dialog box and do nothing
dialog.cancel();
}
});
我NIC = “896201328V” 但它说NIC错配给出的格局。
非常感谢。有用。 – Isuru 2014-10-29 10:17:13
不客气,很高兴它解决了。 – anubhava 2014-10-29 10:17:49