perl-i18n

i18n::substr????

2003-06-05 19:54:00
Hi,

Is there some way to extract a substring in any encoding, ensuring that
valid chars are always extracted?

setlocale(LC_CTYPE, "$locale");
$string = "some_multibyte_or_bidi_string";
$extracted_chars = substr($string, x, y);

is there some magic value for x & y which will work for all encodings?
(I don't care what the offset is once it's >0, nor how long the string
is once it's a valid string of chars contained in $string).

Even better, is there some i18n perl function which would do this
reliably?

thanks,
mags.


<Prev in Thread] Current Thread [Next in Thread>
  • i18n::substr????, Mags Doheny <=