[erlang-questions] parsing text

Wes James comptekki@REDACTED
Fri Apr 30 21:49:07 CEST 2010


On Fri, Apr 30, 2010 at 1:46 PM, Colm Dougan <colm.dougan@REDACTED> wrote:
> If you already found the offset of the start of the number then you
> can use string:to_inetger (or more generally io_lib:fread) to extract
> the number, regardless of it being variable length.
>
> Eshell V5.7.5  (abort with ^G)
> 1> string:to_integer("4880</TD></TR>").
> {4880,"</TD></TR>"}
>
> Eshell V5.7.5  (abort with ^G)
> 1> io_lib:fread("<TD>~d</TD></TR>", "<TD>4880</TD></TR>").
> {ok,[4880],[]}
>
> Colm


Hey that's cool!  Thx Colm!

-wes


More information about the erlang-questions mailing list