string: Tolerate SUBSTRING length exceeding end index

string SUBSTRING command now ignores length if it points
past end of string and uses end of string instead.
String SUBSTRING tests now cover more corner cases.
This commit is contained in:
Domen Vrankar
2014-11-12 23:57:16 +01:00
committed by Brad King
parent a9a040e169
commit 474bbb9dbc
4 changed files with 17 additions and 11 deletions

View File

@@ -73,8 +73,13 @@ TOUPPER/TOLOWER will convert string to upper/lower characters.
LENGTH will return a given string's length.
SUBSTRING will return a substring of a given string. If length is -1
SUBSTRING will return a substring of a given string. If length is -1
the remainder of the string starting at begin will be returned.
If string is shorter than length then end of string is used instead.
.. note::
CMake 3.1 and below reported an error if length pointed past
the end of string.
STRIP will return a substring of a given string with leading and
trailing spaces removed.