From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA18514; Tue, 18 Feb 2003 00:05:57 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id AAA18540 for ; Tue, 18 Feb 2003 00:05:56 +0100 (MET) Received: from marble.he.net (marble.he.net [216.218.230.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h1HN5sP03840 for ; Tue, 18 Feb 2003 00:05:55 +0100 (MET) Received: from ucdavis.edu ([208.227.214.58] (may be forged)) by marble.he.net (8.8.6/8.8.2) with ESMTP id PAA20509 for ; Mon, 17 Feb 2003 15:05:53 -0800 Message-ID: <3E516C1C.4090504@ucdavis.edu> Date: Mon, 17 Feb 2003 15:11:24 -0800 From: Issac Trotts User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020913 Debian/1.1-1 MIME-Version: 1.0 To: OCaml List Subject: Re: [Caml-list] Re: "ocaml_beginners"::[] string to list References: <20030217222143.GH84038@merkur.cert.siemens.de> <3E5167D3.8060203@ucdavis.edu> <20030217225358.GI84038@merkur.cert.siemens.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Christian Schaller wrote: >Issac, > >Thanks a lot for this. I am somewhat surprised, since this should be a >built-in function. Anyway, maybe you can help me with this one, too: is >there also a conversion from character to string or appending a character in >front or at the end of a string? > >- Chris > Hi Chris, Here's a way to make a string from a char: # let c = 'a';; val c : char = 'a' # String.make 1 c;; - : string = "a" It's possible to prepend and append like this: # (String.make 1 c) ^ "foo";; - : string = "afoo" # "foo" ^ (String.make 1 c);; - : string = "fooa" but it is probably more efficient to use the Buffer module (buffer.mli in /usr/lib/ocaml or /usr/local/lib/ocaml). Issac ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners