caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gerd Stolpmann <info@gerd-stolpmann.de>
To: micha-1@fantasymail.de
Cc: caml-list@inria.fr
Subject: AW: [Caml-list] utf-16 string operations
Date: Mon, 30 Jul 2012 13:31:03 +0200	[thread overview]
Message-ID: <1343647863.760.0@samsung> (raw)
In-Reply-To: <50164186.40401@fantasymail.de>

Am 30.07.2012 10:10:46 schrieb(en) Michael:
> 
> What is the prefered way of doing string operations with utf-16  
> strings?
> Say, I have a utf-16 coded string and want to do some search/replace
> operations on it. What is an easy way of doing this?
> 
> Does batteries include functions for doing this? Allthough reading
> through the docs I don't see it.

Search/replace is a bit unspecfic. But normally, it is best to convert  
to UTF-8, and do the operations then. UTF-8 has the advantage that it  
is compatible to many algorithms working byte by byte, i.e. normal  
string operations like substituting a given string by another one, or  
comparing strings.

Conversion support is available e.g. in Camomile, but also in Ocamlnet.  
Camomile has also some direct support for manipulating UTF-16 strings  
encoded as int array (if you need to go down that far).

pcre-ocaml supports regular expressions for UTF-8 strings.

Gerd

> 
> thanks for answering
>  Michael
> 
> 
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> 
> 

-- 
------------------------------------------------------------
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
------------------------------------------------------------

  reply	other threads:[~2012-07-30 11:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30  8:10 Michael
2012-07-30 11:31 ` Gerd Stolpmann [this message]
2012-07-30 13:20   ` Michael

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=1343647863.760.0@samsung \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=gerd@edgespring.com \
    --cc=micha-1@fantasymail.de \
    /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;
as well as URLs for NNTP newsgroup(s).