ENH: Add String length and substring

This commit is contained in:
Andy Cedilnik
2005-10-17 09:56:42 -04:00
parent 6e5cdd6de7
commit 12ef4edf64
4 changed files with 80 additions and 1 deletions

View File

@@ -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

View File

@@ -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");