Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Re: [Caml-list] Concatenation of int and String
  2004-10-22 16:20 [Caml-list] Concatenation of int and String Jan Stamer
@ 2004-10-22 14:24 ` Richard Jones
  2004-10-23 20:31 ` Christophe Raffalli
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2004-10-22 14:24 UTC (permalink / raw)
  Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

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/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Caml-list] Concatenation of int and String
@ 2004-10-22 16:20 Jan Stamer
  2004-10-22 14:24 ` Richard Jones
  2004-10-23 20:31 ` Christophe Raffalli
  0 siblings, 2 replies; 3+ messages in thread
From: Jan Stamer @ 2004-10-22 16:20 UTC (permalink / raw)
  To: caml-list

Hi Folks,

I am very new to OCaml and I am taking my first steps at the moment...

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

Thanks Jan

-- 
************************************
    Jan Stamer
    Katharinenstr. 15
    79104 Freiburg

email:  Jan.Stamer@neptun.uni-freiburg.de
phone:  +49-(0)-761-4808167
mobile: +49-(0)-178-4155553

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Concatenation of int and String
  2004-10-22 16:20 [Caml-list] Concatenation of int and String Jan Stamer
  2004-10-22 14:24 ` Richard Jones
@ 2004-10-23 20:31 ` Christophe Raffalli
  1 sibling, 0 replies; 3+ messages in thread
From: Christophe Raffalli @ 2004-10-23 20:31 UTC (permalink / raw)
  To: Jan Stamer; +Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 747 bytes --]

Jan Stamer wrote:
> Hi Folks,
> 
> I am very new to OCaml and I am taking my first steps at the moment...
> 
> Can you tell me how to concatenate a int and a String?
> 
> Thanks Jan
> 

string_of_int 2 ^ "toto"

or

Printf.sprintf "%d%s" 2 "toto"


-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-10-23 20:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-22 16:20 [Caml-list] Concatenation of int and String Jan Stamer
2004-10-22 14:24 ` Richard Jones
2004-10-23 20:31 ` Christophe Raffalli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox