Date: prev next · Thread: first prev next last
2015 Archives by date, by thread · List index


A1 = "中国"
B1 = MIDB(A1,1,1) returns ""
B1 = MIDB(A1,1,2) returns "中"
B1 = MIDB(A1,1,3) returns "中"
B1 = MIDB(A1,1,4) returns "中国"

I think it is better up to the localizer to translate this help text according to their needs, for 
example Japanese team may show how this works with Japanese chars.

Kevin Suo

于 2015年1月19日 GMT+08:00PM9:16:23, Jesper Hertel <jesper.hertel@gmail.com> 写到:
The help text for MIDB (
https://help.libreoffice.org/Calc/Text_Functions#MIDB) says this:

"

MIDB

Returns a text string of a DBCS text. The parameters specify the
starting
position and the number of characters.

Syntax

MIDB("Text"; Start; Number_bytes)

Text is the text containing the characters to extract.

Start is the position of the first character in the text to extract.

Number_bytes specifies the number of characters MIDB will return from
text,
in bytes.

Example

=MIDB("office";2;2) returns ff.

"

But "office" is not a string written in a double byte character set
(DBCS,
https://en.wikipedia.org/wiki/DBCS), so the example is not helpful for
the
main use of the function.

There should primarily be an example with a string in a language that
actually uses a double byte character set (DBCS), like Chinese. And
then
the example would show that only 1 character is returned when asking
for 2
bytes, i.e. the number of characters returned will be *half* of the
number
of bytes asked for. It should also be noted that if you ask for 3
bytes,
you get 1 character, etc.

The given example only shows the rather special case when you are *not*
giving the function a DBCS string; in this case the number of
characters
returned is the *same* as the number of bytes.


Secondly, the sentence "Number_bytes specifies the number of characters
MIDB will return from text, in bytes" is not very clear, because the
number
does *not* specify the number of characters. The fact is that if you
feed
the function a string in a single byte character set (SBCS,
https://en.wikipedia.org/wiki/SBCS), such as "office", the number of
bytes
is the *same* as the number of characters. If you feed the function a
string in a double byte character set (DBCS), such as a string of
Chinese
characters, the number of bytes is *double* the amount of characters.


I don't know if this is the right place to report this problem.

The problem is probably also known already, and I kind of expect to get
the
reply "oh yeah, we know, the help is a big mess and really needs
improvement.". ;-) But maybe I am wrong, so I am reporting it anyway.


Jesper

-- 
To unsubscribe e-mail to: l10n+unsubscribe@global.libreoffice.org
Problems?
http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more:
http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/l10n/
All messages sent to this list will be publicly archived and cannot be
deleted

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
-- 
To unsubscribe e-mail to: l10n+unsubscribe@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/l10n/
All messages sent to this list will be publicly archived and cannot be deleted

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.