2
Android Java에서이 NIC 번호의 유효성을 검사하고 싶습니다.자바에서 문자열 패턴이 일치하지 않습니다.
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
환영합니다. 다행입니다. – anubhava