Efo74 Posted January 2, 2012 Share Posted January 2, 2012 autoit ConsoleWrite(ControllaPIVA("07643520567")) ;******************************************************************************************************************************** Func ControllaPIVA($string_check) ;******************************************************************************************************************************** ;Ritorna True se la Partita IVA è formalmente corretta. Dim $i,$carattere_estratto Dim $X=0,$Y=0,$Z=0,$T=0 if Stringlen($string_check) <> 11 Then Return False if StringIsDigit($string_check) = 0 Then Return False $X = 0 for $i=1 to 11 step 2 $X += StringMid($string_check,$i,1) Next $Y = 0 for $i=2 to 11 step 2 $carattere_estratto = StringMid($string_check,$i,1) $Y += $carattere_estratto if $carattere_estratto >= 5 Then $Z += 1 Next $Y += $Y $T = Mod($X+$Y+$Z,10) if $T=0 Then return True Return False EndFunc /autoit :rolleyes: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now