[erlang-questions] how: fread/2 with "-" in the input?

Dmitry Belyaev rumata-estor@REDACTED
Fri May 7 11:58:53 CEST 2010


{ok, [Year, Month], _T} = io_lib:fread( "~d-~d", "2-1" ).
{ok,[2,1],[]}


Bengt Kleberg wrote:
> Greetings,
>
> I have the following string: "2-1". I want to read the 2 numbers, like
> this (warning, this does not work);
> {ok, [Year, Month], _T} = io_lib:fread( "~i-~i", "2-1" ).
>
> I get a bad format. Presumably since "-" can be part of the control
> format?
>
> Is there a way to tell fread/2 that I want "-", not a control
>
>
> bengt
>
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>
>   



More information about the erlang-questions mailing list