formatters #14

Merged
zxq9 merged 15 commits from formatters into master 2025-12-22 11:14:20 +09:00
Showing only changes of commit 5a145207da - Show all commits

View File

@ -34,12 +34,12 @@ price(Style, Pucks) ->
-spec price(Unit, Style, Pucks) -> Formatted -spec price(Unit, Style, Pucks) -> Formatted
when Unit :: gaju | puck, when Unit :: gaju | puck,
Style :: us | ch | jp | {Separator, Myriad}, Style :: us | ch | jp | {Separator, Myriad},
Separator :: $, | $. | $_, Separator :: $, | $. | $_,
Myriad :: 3 | 4, Myriad :: 3 | 4,
Pucks :: integer(), Pucks :: integer(),
Formatted :: string(). Formatted :: string().
%% @doc %% @doc
%% A simplified format function covering the most common formats desired. %% A simplified format function covering the most common formats desired.
@ -485,7 +485,12 @@ segment_jp(Format) ->
{error, format} {error, format}
end. end.
read_segment( read_segment([C | T], R, A) when $0 =< C andalso C =< $9 ->
N = C - $0,
read_segment(T, R, [NA);
read_segment([C | T], R, A) when $ =< C andalso C =< $ ->
assemble_jp({GajuSegments, PuckSegments}) -> assemble_jp({GajuSegments, PuckSegments}) ->
GajuString = lists:flatten(lists:map(fun expand_jp_myriad/1, GajuSegments)), GajuString = lists:flatten(lists:map(fun expand_jp_myriad/1, GajuSegments)),