diff options
author | Louis Pilfold <louis@lpil.uk> | 2019-05-29 21:02:55 +0100 |
---|---|---|
committer | Louis Pilfold <louis@lpil.uk> | 2019-06-02 21:12:59 +0100 |
commit | 5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31 (patch) | |
tree | 5d0d281c66cf71c6e3ca880e6621138a71b95e7b /gen/src/std@string.erl | |
parent | ee03f5a0465e176e220060164a5ffc408f73ed0d (diff) | |
download | gleam_stdlib-5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31.tar.gz gleam_stdlib-5a1f3494eb9517a7b7a332cb74dd10a6a7d32d31.zip |
Enable namespaced modules
Diffstat (limited to 'gen/src/std@string.erl')
-rw-r--r-- | gen/src/std@string.erl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gen/src/std@string.erl b/gen/src/std@string.erl new file mode 100644 index 0000000..a86cfac --- /dev/null +++ b/gen/src/std@string.erl @@ -0,0 +1,28 @@ +-module(std@string). +-compile(no_auto_import). + +-export([length/1, lowercase/1, uppercase/1, reverse/1, split/2, replace/3, append/2]). + +length(A) -> + string:length(A). + +lowercase(A) -> + string:lowercase(A). + +uppercase(A) -> + string:uppercase(A). + +reverse(String) -> + std@iodata:to_string(std@iodata:reverse(std@iodata:new(String))). + +split(String, On) -> + std@list:map(std@iodata:split(std@iodata:new(String), On), + fun std@iodata:to_string/1). + +replace(String, Pattern, With) -> + std@iodata:to_string(std@iodata:replace(std@iodata:new(String), + Pattern, + With)). + +append(S1, S2) -> + std@iodata:to_string(std@iodata:append(std@iodata:new(S1), S2)). |