Permalink
Browse files

adding strip command

  • Loading branch information...
1 parent 4603414 commit 0f9446ec23abd0eb1f5342a8cf3303015779eabb Jacob Vorreuter committed Oct 9, 2009
Showing with 10 additions and 0 deletions.
  1. +7 −0 src/ex_eval.erl
  2. +3 −0 src/ex_pp.erl
View
7 src/ex_eval.erl
@@ -89,6 +89,13 @@ expand(State, {concat, Source}) ->
List when is_list(List) -> lists:concat(List);
_ -> {concat, Source}
end;
+
+%% Strip
+expand(State, {strip, Source}) ->
+ case expand(State, Source) of
+ List when is_list(List) -> string:strip(List);
+ _ -> {strip, Source}
+ end;
%% Length
expand(State, {length, Source}) ->
View
3 src/ex_pp.erl
@@ -235,6 +235,9 @@ expand_arg({call, _, {atom, _, last}, [Key]}) ->
expand_arg({call, _, {atom, _, concat}, [Key]}) ->
{tuple, ?L, [{atom,?L,concat}, expand_arg(Key)]};
+expand_arg({call, _, {atom, _, strip}, [Key]}) ->
+ {tuple, ?L, [{atom,?L,strip}, expand_arg(Key)]};
+
expand_arg({call, _, {atom, _, range}, [Start, End]}) ->
{tuple, ?L, [{atom,?L,range}, expand_arg(Start), expand_arg(End)]};

0 comments on commit 0f9446e

Please sign in to comment.