Logo

Programming-Idioms

History of Idiom 41 > diff from v52 to v53

Edit summary for version 53 by programming-idioms.org:
[Kotlin] Variable names s and t

Version 52

2019-09-26, 18:44:37

Version 53

2019-09-27, 08:24:19

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()
Code
val t = s.reversed()