Looks like the stringstrings
package can do this:
\substring{This is a string.}{1}{4}
gives This
, but it seems to be failed for non-ASCII characters:
\substring{这是一个句子。}{1}{4}
cannot give 这是一个
.
Is there a similar package working for Chinese characters?
XeLaTeX
, withxecjk
,xunicode
,fontspec
packages used, thanks.stringstrings
package is not sufficiently utf8-aware. (The package's user guide says that it can handle some 2-byte-encoded characters; however, that's not full utf8-awareness.)