Mercurial > urweb
annotate tests/fromString.ur @ 288:4260ad920c36
Converting string to int
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 07 Sep 2008 11:33:13 -0400 |
parents | |
children | 0cc956a3216f |
rev | line source |
---|---|
adamc@288 | 1 fun i2s s = |
adamc@288 | 2 case stringToInt s of |
adamc@288 | 3 None => 0 |
adamc@288 | 4 | Some n => n |
adamc@288 | 5 |
adamc@288 | 6 fun main () : transaction page = return <html><body> |
adamc@288 | 7 Error = {cdata (show _ (i2s "Error"))}<br/> |
adamc@288 | 8 3 = {cdata (show _ (i2s "+3"))}<br/> |
adamc@288 | 9 </body></html> |
adamc@288 | 10 |