mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-07 22:30:13 -06:00
ENH: Add String length and substring
This commit is contained in:
@@ -22,6 +22,11 @@ STRING(TOUPPER "CMake" tuvar)
|
||||
STRING(TOLOWER "CMake" tlvar)
|
||||
STRING(REPLACE "Autoconf" "CMake" repvar "People should use Autoconf")
|
||||
|
||||
STRING(SUBSTRING "People should use Autoconf" 7 10 substringres)
|
||||
SET(substringres "Everybody ${substringres} CMake")
|
||||
|
||||
STRING(LENGTH ${substringres} lengthres)
|
||||
|
||||
FILE(RELATIVE_PATH relpath "/usr/local/bin" "/usr/X11R6/bin/xnest")
|
||||
|
||||
# Escaping test
|
||||
@@ -54,6 +59,8 @@ FOREACH(var
|
||||
rrepvar
|
||||
repvar
|
||||
relpath
|
||||
substringres
|
||||
lengthres
|
||||
nceqvar
|
||||
ceqvar
|
||||
cneqvar
|
||||
|
||||
@@ -10,7 +10,9 @@ int main(int, char*[])
|
||||
res += CheckMethod(rmallvar, "CMake;cmake;CMake");
|
||||
res += CheckMethod(rrepvar, "People should use CMake and CMake");
|
||||
res += CheckMethod(repvar, "People should use CMake");
|
||||
res += CheckMethod(substringres, "Everybody should use CMake");
|
||||
res += CheckMethod(nceqvar, "0");
|
||||
res += CheckMethod(lengthres, "26");
|
||||
res += CheckMethod(ceqvar, "1");
|
||||
res += CheckMethod(cneqvar, "1");
|
||||
res += CheckMethod(ncneqvar, "0");
|
||||
|
||||
Reference in New Issue
Block a user