aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gleam/string.gleam1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam
index bc13758..c69c0cd 100644
--- a/src/gleam/string.gleam
+++ b/src/gleam/string.gleam
@@ -781,6 +781,7 @@ pub fn first(s: String) -> Result(String, Nil) {
///
pub fn last(s: String) -> Result(String, Nil) {
case pop_grapheme(s) {
+ Ok(#(first, "")) -> Ok(first)
Ok(#(_, rest)) -> Ok(slice(rest, -1, 1))
Error(e) -> Error(e)
}