1. Conclusion </ b>
2. What is the Leet character? </ B>
3. How to code </ b>
4. Development environment </ b>
Use the gsub! </ B> method
It mainly refers to the notation of the alphabet used on the Internet. For example, "HELLO" would be "H3LL5". It will be in the form of applying numbers and letters similar to the alphabet. Below is a table of specific examples, but of course there are A to Z, and there are many ways to express them.
letter | Numbers |
---|---|
A | 4 |
B | 13 |
C | [ |
D | ) |
E | 3 |
. . .
letter | Numbers |
---|---|
Z | 2 |
Referenced URL:
Wikipedia: Leet Symbol Table
variable= gets.chomp
variable.gsub!(/Character string before conversion/,'Converted string')
puts variable
#ex)
#leet_str = gets.chomp
#leet_str.gsub!(/Z/,'2')
#puts leet_str
#"Z"When you enter"2"Converted to
There are other ways, but I used gsub !.
Referenced URL:
[Introduction to Ruby] Summary of character string replacement methods (gsub sub regex)
Mac catalina 10.15.4
Vscode
Ruby 2.6.5
Rails 6.0.3.3
Recommended Posts