diff options
author | Tristan Sloughter <[email protected]> | 2019-05-17 10:50:15 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2019-05-17 10:50:15 -0600 |
commit | f87424e21fa04356a5c4dfbf5eb458b75583be7c (patch) | |
tree | bca67891bc40d4e974a4035c2fc2a9bdbcfe115d /src/rlx_string.erl | |
parent | ffd657605bc3cd390c5bb3270ccb38c540226da0 (diff) | |
parent | 441000c7b0730e96673dfe705a185b82229b30ea (diff) | |
download | relx-f87424e21fa04356a5c4dfbf5eb458b75583be7c.tar.gz relx-f87424e21fa04356a5c4dfbf5eb458b75583be7c.tar.bz2 relx-f87424e21fa04356a5c4dfbf5eb458b75583be7c.zip |
Merge pull request #718 from tsloughter/git-ref
add support for git ref and file content as app version
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 |