Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Concatenation of int and String
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Concatenation of int and String
On Fri, Oct 22, 2004 at 04:20:52PM +0000, Jan Stamer wrote:
> Hi Folks,
> 
> I am very new to OCaml and I am taking my first steps at the moment...

Welcome.  For beginners questions, you may find the beginners' list
more useful: http://groups.yahoo.com/group/ocaml_beginners

> Can you tell me how to concatenate a int and a String?

There are several ways.  Assuming your int is 'i' and your string is
's', then the following will return a string which is a concatenation
of the two:

  Printf.sprintf "%d%s" i s

  string_of_int i ^ s     (* notice this groups as (string_of_int i) ^ s *)

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
NET::FTPSERVER is a full-featured, secure, configurable, database-backed
FTP server written in Perl: http://www.annexia.org/freeware/netftpserver/