|
@ -72,13 +72,24 @@ scan(Format, Args) -> |
|
|
collect(Format, Args) |
|
|
collect(Format, Args) |
|
|
end. |
|
|
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; |
|
|
Acc; |
|
|
doCollectList([OneMatch | MatchList], FmtBinStr, Args, Index, Acc) -> |
|
|
|
|
|
|
|
|
doCollectList(LPart, Args, Acc) -> |
|
|
|
|
|
%% 匹配宽度 |
|
|
|
|
|
case LPart of |
|
|
|
|
|
<<"-", FBin/binary>> -> |
|
|
|
|
|
|
|
|
|
|
|
end, |
|
|
|
|
|
|
|
|
ok. |
|
|
ok. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|