From b97673f54ba0fad406f73c4790d5dd94beced6f9 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Fri, 19 Jul 2019 20:35:40 +1000 Subject: Help: Add note to each string() subcommand that assumes ASCII input Fixes: #19465 --- Help/command/string.rst | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Help/command/string.rst') diff --git a/Help/command/string.rst b/Help/command/string.rst index c0d83f834a..81a2061122 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 ````. If the ```` is not found, a position of -1 is returned. +The ``string(FIND)`` subcommand treats all strings as ASCII-only characters. +The index stored in ```` 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 ```` to upper characters. string(LENGTH ) -Store in an ```` a given string's length. +Store in an ```` a given string's length in bytes. +Note that this means if ```` contains multi-byte characters, the +result stored in ```` will *not* be the number of characters. .. _SUBSTRING: @@ -252,6 +258,9 @@ Store in an ```` a substring of a given ````. If will be returned. If ```` is shorter than ```` then the end of the string is used instead. +Both ```` and ```` are counted in bytes, so care must +be exercised if ```` could contain multi-byte characters. + .. note:: CMake 3.1 and below reported an error if ```` pointed past the end of ````. -- cgit v1.2.1