Add compile-time switch for OTP-20 string funcs
Allows support for Unicode data, and prevents compile warnings that will start with OTP-20.
This commit is contained in:
parent
fa1ec76a9b
commit
f8f72b7cc5
4 changed files with 28 additions and 4 deletions
|
@ -88,7 +88,16 @@ get_patch_count(RawRef) ->
|
|||
parse_tags(Pattern) ->
|
||||
Cmd = io_lib:format("git describe --abbrev=0 --match \"~s*\"", [Pattern]),
|
||||
Tag = os:cmd(Cmd),
|
||||
Vsn = string:substr(Tag, string:len(Pattern) + 1),
|
||||
Vsn1 = string:strip(Vsn, left, $v),
|
||||
Vsn = slice(Tag, len(Pattern) + 1),
|
||||
Vsn1 = trim(Vsn, left, $v),
|
||||
{Tag, Vsn1}.
|
||||
|
||||
-ifdef(unicode_str).
|
||||
len(Str) -> string:length(Str).
|
||||
trim(Str, Dir, Chars) -> string:trim(Str, Dir, Chars).
|
||||
slice(Str, Len) -> string:slice(Str, Len).
|
||||
-else.
|
||||
len(Str) -> string:len(Str).
|
||||
trim(Str, Dir, Chars) -> string:strip(Str, Dir, Chars).
|
||||
slice(Str, Len) -> string:substr(Str, Len).
|
||||
-endif.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue