caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] utf-16 string operations
@ 2012-07-30  8:10 Michael
  2012-07-30 11:31 ` AW: " Gerd Stolpmann
  0 siblings, 1 reply; 3+ messages in thread
From: Michael @ 2012-07-30  8:10 UTC (permalink / raw)
  To: caml-list


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.

thanks for answering
 Michael


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

* AW: [Caml-list] utf-16 string operations
  2012-07-30  8:10 [Caml-list] utf-16 string operations Michael
@ 2012-07-30 11:31 ` Gerd Stolpmann
  2012-07-30 13:20   ` Michael
  0 siblings, 1 reply; 3+ messages in thread
From: Gerd Stolpmann @ 2012-07-30 11:31 UTC (permalink / raw)
  To: micha-1; +Cc: caml-list

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

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

* Re: [Caml-list] utf-16 string operations
  2012-07-30 11:31 ` AW: " Gerd Stolpmann
@ 2012-07-30 13:20   ` Michael
  0 siblings, 0 replies; 3+ messages in thread
From: Michael @ 2012-07-30 13:20 UTC (permalink / raw)
  To: caml-list; +Cc: Gerd Stolpmann, Gerd Stolpmann


thanks for the help.
The conversion with ocamlnet was the mising hint.

Maybe Search/replace is a bit unspecfic, but it's exactly that:

- Str.global_replace (regexp "string") "newstring" utf-16-string


 Michael



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

end of thread, other threads:[~2012-07-30 13:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-30  8:10 [Caml-list] utf-16 string operations Michael
2012-07-30 11:31 ` AW: " Gerd Stolpmann
2012-07-30 13:20   ` Michael

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