List Info

Thread: "ocaml_beginners"::[] How to convert a boolean expression to a string




"ocaml_beginners"::[] How to convert a boolean expression to a string
country flaguser name
United States
2008-06-05 02:05:49

Hi,

I'm newbie for OCaml.
I'm wondering whether there are some built-in function can convert a
string to a boolean exprssion, and convert a boolean expression to a
string.
For instance, convert "s" to a s::bool.
Many Thanks

__._,_.___
.

__,_._,___
Re: "ocaml_beginners"::[] How to convert a boolean expression to a string
country flaguser name
United Kingdom
2008-06-05 04:50:00

On Thursday 05 June 2008 08:05:49 kechenghao wrote:
> Hi,
>
> I'm newbie for OCaml.
> I'm wondering whether there are some built-in function can convert a
> string to a boolean exprssion, and convert a boolean expression to a
> string.

You can use string_of_bool and bool_of_string:

# bool_of_string "true";;
- : bool = true
# bool_of_string "false";;
- : bool = false
# string_of_bool true;;
- : string = "true"

> For instance, convert "s" to a s::bool.

I don't understand this.

--
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?e

__._,_.___
.

__,_._,___
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )