Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,19 @@
function r=rot13(s)
if ischar(s)
r=s; % preallocation and copy of non-letters
for i=1:size(s,1)
for j=1:size(s,2)
if isletter(s(i,j))
if s(i,j)>=97 % lower case
base = 97;
else % upper case
base = 65;
end
r(i,j)=char(mod(s(i,j)-base+13,26)+base);
end
end
end
else
error('Argument must be a CHAR')
end
end

View file

@ -0,0 +1,5 @@
>> rot13('Hello World!')
ans =
Uryyb Jbeyq!

View file

@ -0,0 +1,13 @@
function text = rot13(text)
if ischar(text)
selectedLetters = ( (text >= 'A') & (text <= 'Z') ); %Select upper case letters
text(selectedLetters) = char( mod( text(selectedLetters)-'A'+13,26 )+'A' );
selectedLetters = ( (text >= 'a') & (text <= 'z') ); %Select lower case letters
text(selectedLetters) = char( mod( text(selectedLetters)-'a'+13,26 )+'a' );
else
error('Argument must be a string.')
end
end

View file

@ -0,0 +1,11 @@
>> plainText = char((64:123))
plainText =
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{
>> rot13(plainText)
ans =
@NOPQRSTUVWXYZABCDEFGHIJKLM[\]^_`nopqrstuvwxyzabcdefghijklm{