27 lines
1.1 KiB
C
27 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_rot42.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: gtertysh <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2016/11/03 21:58:10 by gtertysh #+# #+# */
|
|
/* Updated: 2016/11/04 02:01:11 by gtertysh ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
char *ft_rot42(char *str)
|
|
{
|
|
char *begin;
|
|
|
|
begin = str;
|
|
while (*str)
|
|
{
|
|
if (*str >= 'A' && *str <= 'Z')
|
|
*str = (*str - 65 + 42) % 26 + 65;
|
|
else if (*str >= 'a' && *str <= 'z')
|
|
*str = (*str - 97 + 42) % 26 + 97;
|
|
str++;
|
|
}
|
|
return (begin);
|
|
}
|