關於驗證Email正確性作業的程式

2021-04-09 02:03:38 字數 825 閱讀 9673

public class demo1

public demo1()

//system.out.println(intcount1);

for(inti=0;intiif (email.charat(inti) == '.' )

intcount2++;      //要是有多個 。的話intcount2++

//system.out.println(intcount2);

if (intcount1 > 1 ||intcount2 > 1)   //判斷要是有多個「@」和多個「。」返回錯誤

return false;

else

if (email.indexof('@') == -1)

return false;

if (email.indexof('.') == -1)

return false;

if (email.charat(0) == '@' || email.charat(0) == '.')

return false; 

if (email.indexof('@') >= email.indexof('.'))

return false;

if (email == null && email.equals(""))

return false;

else

return true;

public static void main(string args)

system.out.println(demo1.catch([email protected]));

驗證正確性的方法

驗證正確性的方法 1 bug和除錯 bug的 嗎?除錯,就是找出程式中的錯誤並改正 演算法錯誤 是指一個演算法中引起該演算法不能實現其預定目標的熱病和錯誤。主要包括四種基本型別 二義性,語法錯誤,語義錯誤,邏輯錯誤 1.1二義性,演算法中比較容易消除的一類。一般體現在指令表達不準確或者不明確。1.2...

如何驗證 SQL 語句的正確性

定義你想要檢驗的sql語句 declare sql nvarchar max 正確的語句 set sql select from report test1 錯誤的語句 set sql select 1 from declare testsql nvarchar max result intset t...

驗證銀行卡號正確性的演算法

public static functionluhm cardno lastnum substr cardno,1 取出最後一位 與luhm進行比較 first15num substr cardno,0 1 前15或18位 newarr str split strrev first15num 前15...

appium測試中驗證toast的正確性

class class屬性值 contain text,text文字 一 在原生中獲取toast文字 class testtoast def setup self caps caps platformname android caps devicename 192.168.111.101 5555 ...

驗證身份證號的正確性

1.需求 填寫人員資訊時,輸入的身份證號保證不會輸入錯誤,對輸入的身份證號進行校驗 身份證校驗 如果讓你設計個程式,用什麼變數儲存身份證號碼呢?長整數可以嗎?不可以 因為有人的身份證最後一位是 x 實際上,除了最後一位的x,不會出現其它字母 身份證號碼18位 17位 校驗碼 2.實現的演算法 iso...