Browse Source

ft: 修改为二进制匹配

master
SisMaker 4 years ago
parent
commit
7333c4bb59
1 changed files with 17 additions and 6 deletions
  1. +17
    -6
      src/eFmtFormat.erl

+ 17
- 6
src/eFmtFormat.erl View File

@ -72,13 +72,24 @@ scan(Format, Args) ->
collect(Format, Args)
end.
doCollect(FmtBinStr, Args) ->
MatchList = binary:matches(FmtBinStr, <<"~">>),
doCollectList(MatchList, FmtBinStr, Args, 0, []).
doCollectList([], _FmtBinStr, _Args, Index, Acc) ->
doCollect(FmtBinStr, Args, Acc) ->
case binary:split(FmtBinStr, <<"~">>) of
[NotMatch] ->
[NotMatch | Acc];
[FPart, LPart] ->
doCollectList(LPart, Args, [FPart | Acc]).
end,
%% ~F.P.PadModC
doCollectList(<<>>, _Args, Acc) ->
Acc;
doCollectList([OneMatch | MatchList], FmtBinStr, Args, Index, Acc) ->
doCollectList(LPart, Args, Acc) ->
%%
case LPart of
<<"-", FBin/binary>> ->
end,
ok.

Loading…
Cancel
Save