diff --git a/src/eFmtFormat.erl b/src/eFmtFormat.erl index d92aca1..8cb555d 100644 --- a/src/eFmtFormat.erl +++ b/src/eFmtFormat.erl @@ -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.