diff options
author | Tristan Sloughter <[email protected]> | 2019-05-20 09:25:31 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2019-05-20 09:25:31 -0600 |
commit | 670a602f657eeb6ac17589407df8e43cf4d1be89 (patch) | |
tree | 097769798d2d6d00fe3e2ff8a17a04034bf52a8f /src/rlx_string.erl | |
parent | d903c6e52fd7a28e5cee8d0459f0e2ee795f2c93 (diff) | |
parent | cca2a6cade4d97b5b36ca7c055d25677860bdc5d (diff) | |
download | relx-670a602f657eeb6ac17589407df8e43cf4d1be89.tar.gz relx-670a602f657eeb6ac17589407df8e43cf4d1be89.tar.bz2 relx-670a602f657eeb6ac17589407df8e43cf4d1be89.zip |
Merge branch 'master' into goals_option
Diffstat (limited to 'src/rlx_string.erl')
-rw-r--r-- | src/rlx_string.erl | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rlx_string.erl b/src/rlx_string.erl index 1f9cc0c..d5f5046 100644 --- a/src/rlx_string.erl +++ b/src/rlx_string.erl @@ -2,14 +2,22 @@ %% OTP-19 and OTP-21, where Unicode support means the deprecation %% of a lot of string functions. -module(rlx_string). --export([concat/2, lexemes/2, join/2]). +-export([concat/2, lexemes/2, join/2, trim/3]). -ifdef(unicode_str). concat(Str1, Str2) -> unicode:characters_to_list([Str1,Str2]). lexemes(Str, Separators) -> string:lexemes(Str, Separators). +trim(Str, Direction, Cluster=[_]) -> string:trim(Str, Direction, Cluster). -else. concat(Str1, Str2) -> string:concat(Str1, Str2). lexemes(Str, Separators) -> string:tokens(Str, Separators). +trim(Str, Direction, [Char]) -> + Dir = case Direction of + both -> both; + leading -> left; + trailing -> right + end, + string:strip(Str, Dir, Char). -endif. %% string:join/2 copy; string:join/2 is getting obsoleted |