簡單手機號碼資料加密解密

2021-07-22 02:17:34 字數 2004 閱讀 5317

/**

* main

* @param args

*/public static void main(string args)

/*** 數字 0 1 2 3 4 5 6 7 8 9

* 字母 b a c g h k o w q p

* @param val

* @return 數字轉字母

*/public static string getphonestr(string val)

} return returnstr;

} /**

* 字母轉數字

* 字母 b a c g h k o w q p

* 數字 0 1 2 3 4 5 6 7 8 9

* @param val

* @return

*/public static string getphonenum(string val)

} return returnstr; }

/***

* 換位號碼中兩組數字:第二位和第六位交換,第三位和第五位交換,位數號按從左往右數

* 13510642584

* 16015342584

*/public static string changenum(string val)

return val; }

/*** 字母 b a c g h k o w q p

* 數字 0 1 2 3 4 5 6 7 8 9

* @return map

*/public static mapgetmapdata()

/*** 字串前增加「~」

*/public static string prefixstr(string val)

/*** 過濾字串前的「~」

*/public static string filterstr(string val)

if(val!=null&&val.indexof("%")>-1)

return val; }

/*** 去除所有數字

*/public static string removenum(string val)

/*** 隨機插入3個數字

*/public static string insertnum(string val)

return val; }

/*** 隨機生成i位數字

* i<10

*/public static string radomnum(int i)

/*** :加密步驟:

* 1、換位號碼中兩組數字:第二位和第六位交換,第三位和第五位交換

* 2、將全部號碼轉換為對應的字元

* 3、任意位置插入三個隨機數字

* 4、在步驟c之後的字串前加上」~」

* @return

*/public static string encryptphone(string phonestr)

/*** :解密步驟:

* 1、去除字串前」~」

* 2、去除所有數字

* 3、將剩餘字母全部轉換為對應的數字

* 4、換位號碼中兩組數字:第二位和第六位交換,第三位和第五位交換

* @return

*/public static string decryptphone(string phonestr)

return phonestr;

}

/*** 正規表示式數字驗證

* * @author crab

* @param str

* @return

*/public static boolean isnumber(string str) else

}/**

* 字串非空非null判斷 crab

*/public static boolean isempty(string val) else

}

獲取手機號碼

使用telephonymanager.getdefault getline1number 已經不能獲得目前移動sim卡的 號碼了,老的sim卡也許可以,現在介紹一種方法,可以獲得手機號碼 cursor mycursor getcontentresolver query uri.parse conte...

匹配手機號碼

1 static void main string args 222 string pattern 1 23 regex rx new regex pattern 24 string input 18817889736 23487 3241247531432 432432145 1589556581...

手機號碼驗證

正規表示式的使用 正規表示式的元素符及其意義 元素符正規表示式中的寫法意義.代表任意乙個字元 d d 代表0 9的任意乙個數字 d d 代表任何乙個非數字字元 s s 代表空白字元,如 t n s s 代表非空白字元 w w 代表可用作識別符號的字元,但不包括 符 w w 代表不可用於識別符號的字元...