the newline _character_?
Luke Gorrie
luke@REDACTED
Thu Nov 21 18:14:49 CET 2002
Ulf Wiger <etxuwig@REDACTED> writes:
> On Thu, 21 Nov 2002, Bengt Kleberg wrote:
>
> >moreover, is there is_whitespace() function is some module?
>
> In xmerl, it's done like this:
>
> %% whitespace consists of 'space', 'carriage return',
> %% 'line feed' or 'tab'
> -define(whitespace(H), H==?space ;
> H==?cr ;
> H==?lf ;
> H==?tab).
>
> Example:
>
> scan_prolog(T = [H|_], S, Pos) when ?whitespace(H) ->
> ?dbg("prolog(whitespace)~n", []),
> ?strip1,
> scan_prolog(T1, S1, Pos).
>
>
> Beautiful, eh? ;-)
The C programmer in me wonders what this would do:
atom_and_whitespace(A, Ch) when atom(A), ?whitespace(Ch) -> true;
atom_and_whitespace(A, Ch) -> false.
:-)
-Luke
More information about the erlang-questions
mailing list