Logo

Programming-Idioms

History of Idiom 41 > diff from v50 to v51

Edit summary for version 51 by fojji:
New Kotlin implementation by user [fojji]

Version 50

2019-09-26, 17:29:39

Version 51

2019-09-26, 18:43:23

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
val reversed = "this is a string".reversed()