diff options
author | Louis Pilfold <louis@lpil.uk> | 2020-01-13 22:02:06 +0000 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2020-01-13 22:39:29 +0000 |
commit | ab2e2ddeae10d623f6a56cb2894414e3101b5556 (patch) | |
tree | fc968b55bab025b8ee10949836dd7859c3761136 | |
parent | 071cb05a8b3d6d906fdbcc8e31f2855a08949fa9 (diff) | |
download | gleam_stdlib-ab2e2ddeae10d623f6a56cb2894414e3101b5556.tar.gz gleam_stdlib-ab2e2ddeae10d623f6a56cb2894414e3101b5556.zip |
Type annotations for gleam/string
-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) |