File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change 1
- //! Rot13 or "rotate by 13 places"
2
- //!
3
- //! # Algorithm
4
-
5
- /// Encrypts a given [`&str`] using ROT13 cipher.
1
+ /// Encrypts a given [`&str`] using ROT13 cipher or "rotate by 13 places"
6
2
///
7
3
/// See [ROT13](https://en.wikipedia.org/wiki/ROT13) for more information.
8
4
///
9
5
/// Replaces each character with the 13th letter after it in the alphabet.
10
- /// Rot13 is a special case of [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher)
6
+ /// Rot13 is a special case of a [Caesar cipher](https://en.wikipedia.org/wiki/Caesar_cipher)
11
7
///
12
8
/// The most basic example is ROT 13, which rotates 'a' to 'n'.
13
9
/// This implementation does not rotate unicode characters.
14
10
///
15
11
/// # Arguments
16
12
///
17
- /// `text` - String to transform.
13
+ /// * `text` - String to transform.
18
14
///
19
15
/// # Returns
20
16
///
21
- /// An owned [`String`]
22
- ///
23
- /// # Panic
24
- ///
25
- /// This function won't panic.
17
+ /// An owned [`String`] with the transformed text.
26
18
///
27
19
/// # Examples
28
- /// ```
29
- /// # use rust_algorithms::ciphers::rot13;
20
+ /// ```rust
21
+ /// use rust_algorithms::ciphers::rot13;
22
+ ///
30
23
/// let encoded = rot13("hello world");
24
+ ///
31
25
/// assert_eq!(encoded, "URYYB JBEYQ");
32
26
/// ```
33
27
pub fn rot13 ( text : & str ) -> String {
You can’t perform that action at this time.
0 commit comments