Skip to content

Commit 6891cc5

Browse files
committed
Add reverse function
1 parent 9d54395 commit 6891cc5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

stringutils/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ def lines(string, keepends=False):
2626
"""
2727
return string.splitlines(keepends)
2828

29+
def reverse(string):
30+
"""
31+
Reverse the order of the characters in a string.
32+
"""
33+
return string[::-1]
34+
2935
def words(string):
3036
"""
3137
Split a string into a list of words, which were delimited by one or more

0 commit comments

Comments
 (0)