From: dmitry grebeniuk <gdsfh1@gmail.com>
To: Morozov Matvey <comaMM@yandex.ru>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Camomile library tutorial/examples?
Date: Sun, 6 Sep 2009 10:49:23 +0300 [thread overview]
Message-ID: <b364036a0909060049o786832c2jc413e02c9dee2cf2@mail.gmail.com> (raw)
In-Reply-To: <367461252186926@webmail120.yandex.ru>
> Recently I tried to add some unicode support to my project (for instance I need to convert Cyrillic characters from uppercase to lowercase and vice versa).
I don't know of any good documentation on Camomile, but here is a
code that converts line from terminal to uppercase and lowercase,
assuming that your terminal's encoding is utf8.
===== camotest.ml =====
open Printf
module PREF = CamomileLibrary.Default.Camomile
module CE = PREF.CharEncoding
module CM = PREF.CaseMap.Make(PREF.UTF8)
let _ =
try
while true do printf "> %!";
let line = input_line stdin in
let up = CM.uppercase line
and low = CM.lowercase line
in printf "ORIG : %s\nUPPER: %s\nLOWER: %s\n%!" line up low
done
with
| End_of_file -> ()
===== / camotest.ml =====
$ ocamlfind ocamlc -package camomile -linkpkg camotest.ml -o camotest
$ ./camotest
btw, if you speak russian (as I can guess), you can join the jabber conference
ocaml@conference.jabber.ru , some questions are solved faster than via
mail-lists.
prev parent reply other threads:[~2009-09-06 7:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-05 21:42 Morozov Matvey
2009-09-06 7:41 ` [Caml-list] " dmitry grebeniuk
2009-09-06 7:49 ` dmitry grebeniuk [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b364036a0909060049o786832c2jc413e02c9dee2cf2@mail.gmail.com \
--to=gdsfh1@gmail.com \
--cc=caml-list@yquem.inria.fr \
--cc=comaMM@yandex.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox