Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
2415ff67
Commit
2415ff67
authored
Mar 10, 2005
by
Sebastien Barre
Browse files
ENH: remove deps to vtkString by using KWSys (a handful of functions have been moved to KWSys)
parent
07bdc600
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/kwsys/SystemTools.cxx
View file @
2415ff67
...
@@ -936,6 +936,28 @@ char* SystemTools::ReplaceChars(char* str, const char *toreplace, char replaceme
...
@@ -936,6 +936,28 @@ char* SystemTools::ReplaceChars(char* str, const char *toreplace, char replaceme
return
str
;
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
// Returns a pointer to the last occurence of str2 in str1
const
char
*
SystemTools
::
FindLastString
(
const
char
*
str1
,
const
char
*
str2
)
const
char
*
SystemTools
::
FindLastString
(
const
char
*
str1
,
const
char
*
str2
)
{
{
...
...
Source/kwsys/SystemTools.hxx.in
View file @
2415ff67
...
@@ -154,6 +154,12 @@ public:
...
@@ -154,6 +154,12 @@ public:
*/
*/
static char* ReplaceChars(char* str, const char *toreplace,char replacement);
static char* ReplaceChars(char* str, const char *toreplace,char replacement);
/**
* Returns true if str1 starts or ends with str2
*/
static bool StringStartsWith(const char* str1, const char* str2);
static bool StringEndsWith(const char* str1, const char* str2);
/**
/**
* Returns a pointer to the last occurence of str2 in str1
* Returns a pointer to the last occurence of str2 in str1
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment