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