Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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:

> 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 *)


Richard Jones.
Merjis Ltd. - improving website return on investment
NET::FTPSERVER is a full-featured, secure, configurable, database-backed
FTP server written in Perl: