diff options
-rw-r--r-- | src/gleam/string.gleam | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam index 851dbca..92d46b6 100644 --- a/src/gleam/string.gleam +++ b/src/gleam/string.gleam @@ -11,28 +11,32 @@ pub external fn uppercase(String) -> String = "string" "uppercase" pub external fn compare(String, String) -> order.Order = "gleam_stdlib" "compare_strings" -pub fn reverse(string) { +pub fn reverse(string: String) -> String { string |> iodata.new |> iodata.reverse |> iodata.to_string } -pub fn split(string x, on pattern) { +pub fn split(string x: String, on pattern: String) -> List(String) { x |> iodata.new |> iodata.split(_, on: pattern) |> list.map(_, with: iodata.to_string) } -pub fn replace(in string, all pattern, with substitute) { +pub fn replace( + in string: String, + all pattern: String, + with substitute: String, +) -> String { string |> iodata.new |> iodata.replace(_, all: pattern, with: substitute) |> iodata.to_string } -pub fn append(to first, suffix second) { +pub fn append(to first: String, suffix second: String) -> String { first |> iodata.new |> iodata.append(_, second) |