aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gleam/string.gleam10
-rw-r--r--src/gleam_stdlib.erl4
2 files changed, 8 insertions, 6 deletions
diff --git a/src/gleam/string.gleam b/src/gleam/string.gleam
index 91d54b4..1dd484a 100644
--- a/src/gleam/string.gleam
+++ b/src/gleam/string.gleam
@@ -310,8 +310,12 @@ pub fn join(strings: List(String), with separator: String) -> String {
//
// pub fn pad_right(string: String, to size: Int, with: String) {}
-pub external fn erl_trim(String) -> String =
- "gleam_stdlib" "string_trim"
+type Direction {
+ Both
+}
+
+external fn erl_trim(String, Direction) -> String =
+ "string" "trim"
/// Get rid of whitespace on both sides of a String.
///
@@ -321,7 +325,7 @@ pub external fn erl_trim(String) -> String =
///
///
pub fn trim(string: String) -> String {
- erl_trim(string)
+ erl_trim(string, Both)
}
// TODO
diff --git a/src/gleam_stdlib.erl b/src/gleam_stdlib.erl
index 54fcdaa..49a7e2a 100644
--- a/src/gleam_stdlib.erl
+++ b/src/gleam_stdlib.erl
@@ -7,7 +7,7 @@
iodata_append/2, iodata_prepend/2, identity/1, decode_int/1,
decode_string/1, decode_bool/1, decode_float/1, decode_thunk/1, decode_atom/1,
decode_list/1, decode_field/2, decode_element/2, parse_int/1, parse_float/1, compare_strings/2,
- string_contains/2, string_trim/1]).
+ string_contains/2]).
should_equal(Actual, Expected) -> ?assertEqual(Expected, Actual).
should_not_equal(Actual, Expected) -> ?assertNotEqual(Expected, Actual).
@@ -127,5 +127,3 @@ string_contains(Haystack, Needle) ->
_ ->
true
end.
-
-string_trim(String) -> string:trim(String, both).