ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¦Û¦æ§PÂ_¤£²Å¦Xªº°}¦C¸ê®Æ¨Ã²¾°£¡C

¦^´_ 1# tku0216
¨Ì·Ó¨­¤ÀÃÒ¦r¸¹³W«hÅçÃÒ
«D¦³®Ä¦r¸¹«h±Æ°£
¥Î¤@·s°}¦CÀx¦s¥¿½T¦r¸¹
  1. Option Explicit

  2. Sub ex()
  3. Dim A(0 To 4) As String, Ar() As String, i&, s&
  4. A(0) = "A123456789"
  5. A(1) = "B521632157"
  6. A(2) = "A001"
  7. A(3) = "A02"
  8. A(4) = "S512935123"
  9. For i = 0 To 4
  10.    If Pass(A(i)) Then
  11.       ReDim Preserve Ar(s)
  12.       Ar(s) = A(i)
  13.       s = s + 1
  14.    End If
  15. Next
  16. MsgBox Join(Ar, Chr(10))
  17. End Sub
  18. Function Pass(Mystr As String) As Boolean '¦r¸¹ÅçÃÒ
  19. Dim x, y%, k%, i%
  20. If Asc(Left(Mystr, 1)) < 65 Or Asc(Left(Mystr, 1)) > 90 Or Len(Mystr) <> 10 Then Pass = False: Exit Function
  21. k = Application.Match(Left(Mystr, 1), Array("A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "I", "O"), 0) + 9
  22. y = (k Mod 10) * 9 + Int(k / 10)
  23. x = Array(0, 0, 8, 7, 6, 5, 4, 3, 2, 1, 1)
  24. For i = 2 To Len(Mystr) - 1
  25.    y = y + Val(Mid(Mystr, i, 1)) * x(i)
  26. Next
  27. Pass = 10 - (y Mod 10) = Val(Right(Mystr, 1))
  28. End Function
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

        ÀR«ä¦Û¦b : ¡i®É¤é²öªÅ¹L¡j¤@­Ó¤H¦b¥@¶¡°µ¤F¦h¤Ö¨Æ¡A´Nµ¥©ó¹Ø©R¦³¦hªø¡C¦]¦¹¥²¶·»P®É¶¡Ävª§¡A¤Á²ö¨Ï®É¤éªÅ¹L¡C
ªð¦^¦Cªí ¤W¤@¥DÃD