diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-07-19 10:35:40 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2019-07-19 10:47:21 (GMT) |
commit | b97673f54ba0fad406f73c4790d5dd94beced6f9 (patch) | |
tree | 9a8e779c3042592441c70c3bd58b2a474039ea93 /Help/command/string.rst | |
parent | 26cd64d9776aa418d0083374084ff7738422b4c4 (diff) | |
download | CMake-b97673f54ba0fad406f73c4790d5dd94beced6f9.zip CMake-b97673f54ba0fad406f73c4790d5dd94beced6f9.tar.gz CMake-b97673f54ba0fad406f73c4790d5dd94beced6f9.tar.bz2 |
Help: Add note to each string() subcommand that assumes ASCII input
Fixes: #19465
Diffstat (limited to 'Help/command/string.rst')
-rw-r--r-- | Help/command/string.rst | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Help/command/string.rst b/Help/command/string.rst index c0d83f8..81a2061 100644 --- a/Help/command/string.rst +++ b/Help/command/string.rst @@ -59,6 +59,10 @@ search for the position of the last occurrence of the specified ``<substring>``. If the ``<substring>`` is not found, a position of -1 is returned. +The ``string(FIND)`` subcommand treats all strings as ASCII-only characters. +The index stored in ``<output_variable>`` will also be counted in bytes, +so strings containing multi-byte characters may lead to unexpected results. + .. _REPLACE: .. code-block:: cmake @@ -239,7 +243,9 @@ Convert ``<string>`` to upper characters. string(LENGTH <string> <output_variable>) -Store in an ``<output_variable>`` a given string's length. +Store in an ``<output_variable>`` a given string's length in bytes. +Note that this means if ``<string>`` contains multi-byte characters, the +result stored in ``<output_variable>`` will *not* be the number of characters. .. _SUBSTRING: @@ -252,6 +258,9 @@ Store in an ``<output_variable>`` a substring of a given ``<string>``. If will be returned. If ``<string>`` is shorter than ``<length>`` then the end of the string is used instead. +Both ``<begin>`` and ``<length>`` are counted in bytes, so care must +be exercised if ``<string>`` could contain multi-byte characters. + .. note:: CMake 3.1 and below reported an error if ``<length>`` pointed past the end of ``<string>``. |