Logo

Programming-Idioms

History of Idiom 41 > diff from v27 to v28

Edit summary for version 28 by programming-idioms.org:
[Ruby] +DemoURL

Version 27

2016-09-27, 15:57:08

Version 28

2016-11-13, 15:02:38

Idiom #41 Reverse a string

Create string t containing the same characters as string s, in reverse order.
Original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory.

Illustration

Idiom #41 Reverse a string

Create string t containing the same characters as string s, in reverse order.
Original string s must remain unaltered. Each character must be handled correctly regardless its number of bytes in memory.

Illustration
Code
t = s.reverse
Code
t = s.reverse
Doc URL
http://ruby-doc.org/core-1.8.6/String.html#method-i-reverse-21
Doc URL
http://ruby-doc.org/core-1.8.6/String.html#method-i-reverse-21
Demo URL
https://repl.it/EWd0/1