June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
24
Task/Rot-13/Visual-Basic/rot-13-1.vb
Normal file
24
Task/Rot-13/Visual-Basic/rot-13-1.vb
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
Function ROT13(ByVal a As String) As String
|
||||
Dim i As Long
|
||||
Dim n As Integer, e As Integer
|
||||
|
||||
ROT13 = a
|
||||
For i = 1 To Len(a)
|
||||
n = Asc(Mid$(a, i, 1))
|
||||
Select Case n
|
||||
Case 65 To 90
|
||||
e = 90
|
||||
n = n + 13
|
||||
Case 97 To 122
|
||||
e = 122
|
||||
n = n + 13
|
||||
Case Else
|
||||
e = 255
|
||||
End Select
|
||||
|
||||
If n > e Then
|
||||
n = n - 26
|
||||
End If
|
||||
Mid$(ROT13, i, 1) = Chr$(n)
|
||||
Next i
|
||||
End Function
|
||||
4
Task/Rot-13/Visual-Basic/rot-13-2.vb
Normal file
4
Task/Rot-13/Visual-Basic/rot-13-2.vb
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
Sub Main()
|
||||
Debug.Assert ROT13("abc") = "nop"
|
||||
Debug.Assert ROT13("nop") = "abc"
|
||||
End Sub
|
||||
Loading…
Add table
Add a link
Reference in a new issue