summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/SystemTools.cxx
diff options
context:
space:
mode:
authorSebastien Barre <sebastien.barre@kitware.com>2005-03-10 22:44:58 (GMT)
committerSebastien Barre <sebastien.barre@kitware.com>2005-03-10 22:44:58 (GMT)
commit2415ff678a80ede6f0a05ab80ad3835fe6d810c2 (patch)
tree5c93b4b8a4f16e4eea338a08f9a0e0477b186df8 /Source/kwsys/SystemTools.cxx
parent07bdc600455744e608b1af720af5c29a32c38da8 (diff)
downloadCMake-2415ff678a80ede6f0a05ab80ad3835fe6d810c2.zip
CMake-2415ff678a80ede6f0a05ab80ad3835fe6d810c2.tar.gz
CMake-2415ff678a80ede6f0a05ab80ad3835fe6d810c2.tar.bz2
ENH: remove deps to vtkString by using KWSys (a handful of functions have been moved to KWSys)
Diffstat (limited to 'Source/kwsys/SystemTools.cxx')
-rw-r--r--Source/kwsys/SystemTools.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 6e57bb6..5abac99 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -936,6 +936,28 @@ char* SystemTools::ReplaceChars(char* str, const char *toreplace, char replaceme
return str;
}
+// Returns if string starts with another string
+bool vtkString::StringStartsWith(const char* str1, const char* str2)
+{
+ if (!str1 || !str2)
+ {
+ return false;
+ }
+ size_t len1 = strlen(str1), len2 = strlen(str2);
+ return len1 >= len2 && !strncmp(str1, str2, len2) ? true : false
+}
+
+// Returns if string ends with another string
+bool vtkString::StringEndsWith(const char* str1, const char* str2)
+{
+ if (!str1 || !str2)
+ {
+ return false;
+ }
+ size_t len1 = strlen(str1), len2 = strlen(str2);
+ return len1 >= len2 && !strncmp(str1 + (len1 - len2), str2, len2) ? true : false;
+}
+
// Returns a pointer to the last occurence of str2 in str1
const char* SystemTools::FindLastString(const char* str1, const char* str2)
{