Recently, I was busy with the business Assistant of the company. I found some problems with mobile phone number verification. When I fixed the bug myself, my colleagues used the system to write some functions. I looked at the prototype of the function. Although simple, I still stayed to learn or use it whenever.
Function GetMobileType (mobile: string): integer; //-1 error, PHS, mobile phone 2, Unicom 3
Var
Mblen: integer;
Tmp_mobile: int64;
MbHeader: string;
Begin
Result: =-1;
Tmp_mobile: = StrToInt64Def (mobile, 0 );
MbHeader: = copy (mobile, 1, 4 );
If mbheader = '000000' then exit;
MbHeader: = copy (mobile, 1, 3 );
If tmp_mobile = 0 then exit;
If length (mobile) = 11 then
If (mbHeader = '000000') or (mbHeader = '000000') or (mbHeader = '000000') or (mbHeader = '000000 ')
Or (mbHeader = '000000') or (mbHeader = '000000') or (mbHeader = '000000') or (mbHeader = '000000 ')
Or (mbHeader = '000000 ')
Or (mbHeader = '000000 ')
Or (mbHeader = '000000') then
Result: = 2;
End;