VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



rot13 function

by alexK (9 Submissions)
Category: VB function enhancement
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Thu 4th February 2021
Rating: (1 Votes)

A function to rot13 a string

Rate rot13 function

Function rot13(rot13text)
   rot13text_rotated = "" 
   For i = 1 to Len(rot13text)
      j = Mid(rot13text, i, 1) 
      k = Asc(j) 
      if k >= 97 and k =< 109 then
         k = k + 13 ' a ... m inclusive become n ... z
      elseif k >= 110 and k =< 122 then
         k = k - 13 ' n ... z inclusive become a ... m
      elseif k >= 65 and k =< 77 then
         k = k + 13 ' A ... M inclusive become N ... Z
      elseif k >= 78 and k =< 90 then
         k = k - 13 ' N ... Z inclusive become A ... M
      end if
   rot13text_rotated = rot13text_rotated & Chr(k)
   Next
rot13 = rot13text_rotated
End Function

Download this snippet    Add to My Saved Code

rot13 function Comments

No comments have been posted about rot13 function. Why not be the first to post a comment about rot13 function.

Post your comment

Subject:
Message:
0/1000 characters