Hatena::Grouperlang

YのErlang

 | 

2008-05-17

結局例外(正規表現は止め)で数値かどうか分けるようにした

14:28

これで互換を保てそう。

symbol(Value) ->
    try
	case string:str(Value, ".") of
	    0 ->
		Fun = fun list_to_integer/1;
	    _ ->
		Fun = fun list_to_float/1
	end,
	#symbol{v=Fun(Value)}
    catch
	_:_ -> #symbol{v=string:to_lower(Value)}
    end.

HomeroHomero2012/10/08 15:32I want to send you an award for most helpful internet wiretr.

xizrwzxizrwz2012/10/09 05:32bZZZDZ <a href="http://actifbqnrdga.com/">actifbqnrdga</a>

nnwixootarnnwixootar2012/10/09 15:07zf6mOj , [url=http://vfattctkjxro.com/]vfattctkjxro[/url], [link=http://bchfyawvwxhg.com/]bchfyawvwxhg[/link], http://sccqcbtqnabu.com/

znutdeknuznutdeknu2012/10/10 23:09lmHBON <a href="http://xfkfrfvdcfun.com/">xfkfrfvdcfun</a>

daynthhbedaynthhbe2012/10/12 03:077ysoCT , [url=http://fdgihxxnlnla.com/]fdgihxxnlnla[/url], [link=http://kejzojlgguwp.com/]kejzojlgguwp[/link], http://lkbnypcveeix.com/

 |