Wishes: hex-output
Chandrashekhar Mullaparthi
Chandrashekhar.Mullaparthi@REDACTED
Thu Feb 1 12:57:09 CET 2001
These functions can probably be added to lists or string.
to_lower(Str) ->
to_lower(Str, []).
to_lower([H|T], Acc) when H>=65, H =< 90 ->
to_lower(T, [H+32|Acc]);
to_lower([H|T], Acc) ->
to_lower(T, [H|Acc]);
to_lower([], Acc) ->
lists:reverse(Acc).
to_upper(Str) ->
to_upper(Str, []).
to_upper([H|T], Acc) when H>=97, H =< 122 ->
to_upper(T, [H-32|Acc]);
to_upper([H|T], Acc) ->
to_upper(T, [H|Acc]);
to_upper([], Acc) ->
lists:reverse(Acc).
regards,
Chandru
> -----Original Message-----
> From: Robert Virding [mailto:rv@REDACTED]
> Sent: 18 January 2001 10:14
> To: Erik Johansson
> Cc: erlang-questions@REDACTED; Jouni.Ryno@REDACTED
> Subject: Re: Wishes: hex-output
>
>
> "Erik Johansson" <happi@REDACTED> writes:
> >
> >----- Original Message -----
> >From: <Jouni.Ryno@REDACTED>
> >>
> >> If it's going to be late Christmas season, and one could make some
> >> wishes, what about hex-output for io:format
> >>
> >
> >Yes. I have always needed this. I use ~h and ~H. With the
> patch below you
> >can do:
> >> io:format("~h 0x~H 16#~h\n", [51966, 51966, 51966]).
> >cafe 0xCAFE 16#cafe
> >>
>
> Seems reasonable. I'll add it. My only small qualm is that the
> coupling ~h/~H does not mean the same thing as ~w/~W and ~p/~P, but I
> suppose there is not real problem here.
>
> There should be probably be a matching hex-input flag for
> io:fread. I
> suppose I had better do that one as well.
>
> Robert
>
>
NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.
More information about the erlang-questions
mailing list