codice:
Function VerificaVodafone(ByVal Numero As String) As Integer
Dim Vodafone As String(), strInt As String
Dim ArrInt As String(), Sep As Char()
If Numero.Chars(0) <> "+" Then
If Numero.Substring(0, 2) = "00" Then
Numero = "+" & Numero.Substring(2)
Else
Return -1
End If
End If
Sep = New Char() {","c}
strInt = "+6721012,+1876,+1869,+1868,+1787,+1784,+1767,+1758,+1664,+1649,+1473,+1441,+1345,+1340,+1284,+1268,+1264,+1246,+1242,+998,+996,+995,+994,+993,+977,+976,+975,+974,+973,+972,+971,+968,+967,+966,+965,+964,+963,+962,+961,+960,+886,+880,+856,+855,+853,+852,+850,+737,+692,+689,+688,+687,+686,+685,+684,+683,+682,+681,+680,+679,+678,+677,+676,+675,+673,+672,+671,+670,+599,+598,+596,+595,+594,+593,+592,+591,+590,+509,+508,+507,+506,+505,+504,+503,+502,+501,+500,+423,+421,+420,+389,+387,+386,+385,+381,+380,+377,+376,+375,+374,+373,+372,+371,+370,+359,+358,+357,+356,+355,+354,+353,+352,+351,+350,+299,+298,+297,+291,+290,+269,+268,+267,+266,+265,+264,+263,+262,+261,+260,+258,+257,+256,+255,+254,+253,+252,+251,+250,+249,+248,+247,+246,+245,+244,+243,+242,+241,+240,+239,+238,+237,+236,+235,+234,+233,+232,+231,+230,+229,+228,+226,+225,+224,+223,+222,+221,+220,+218,+216,+213,+212,+98,+94,+93,+92,+91,+90,+86,+84,+82,+81,+66,+65,+64,+63,+62,+61,+60,+58,+57,+56,+55,+54,+53,+52,+51,+49,+48,+47,+46,+45,+44,+43,+41,+40,+39,+36,+34,+33,+32,+31,+30,+27,+20,+7,+1"
ArrInt = strInt.Split(Sep, StringSplitOptions.RemoveEmptyEntries)
Vodafone = New String() {"340", "343", "346", "347", "348", "349"}
For Each Prefisso As String In ArrInt
If Numero.StartsWith(Prefisso) Then
For Each PrefCell As String In Vodafone
If Numero.Substring(Prefisso.Length, 3) = PrefCell Then
Return 1
End If
Next
Return 0
End If
Next
Return -1
End Function
Valori Restituiti: