Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
acgl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ACGL
acgl
Commits
9fbe7d89
Commit
9fbe7d89
authored
May 18, 2012
by
Robert Menzel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanups
parent
5fae4d7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
include/ACGL/Base/StringOperations.hh
include/ACGL/Base/StringOperations.hh
+1
-1
src/ACGL/Base/StringOperations.cc
src/ACGL/Base/StringOperations.cc
+9
-11
No files found.
include/ACGL/Base/StringOperations.hh
View file @
9fbe7d89
...
...
@@ -25,7 +25,7 @@ namespace StringOperations
bool
splitFileExtension
(
const
std
::
string
&
_full
,
std
::
string
&
_file
,
std
::
string
&
_extension
);
bool
splitLastFileOrFolder
(
const
std
::
string
&
_full
,
std
::
string
&
_path
,
std
::
string
&
_fileOrFolder
);
bool
startsWith
(
const
std
::
string
&
_string
,
const
std
::
string
&
_prefix
);
bool
startsWith
(
const
std
::
string
&
_string
,
const
char
&
_prefix
);
bool
startsWith
(
const
std
::
string
&
_string
,
const
char
_prefix
);
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
_string
,
char
_splitChar
,
bool
_skipEmptyStrings
=
true
);
...
...
src/ACGL/Base/StringOperations.cc
View file @
9fbe7d89
...
...
@@ -36,25 +36,23 @@ namespace StringOperations
bool
startsWith
(
const
std
::
string
&
_string
,
const
std
::
string
&
_prefix
)
{
if
(
_prefix
.
length
()
>
_string
.
length
())
std
::
size_t
prefixLen
=
_prefix
.
length
();
if
(
prefixLen
>
_string
.
length
())
return
false
;
for
(
std
::
size_t
i
=
0
;
i
<
_prefix
.
length
()
;
i
++
)
for
(
std
::
size_t
i
=
0
;
i
<
prefixLen
;
i
++
)
if
(
_prefix
[
i
]
!=
_string
[
i
])
return
false
;
return
true
;
// a bit slower in some cases:
//return (std::mismatch(_prefix.begin(), _prefix.end(), _string.begin()).first == _prefix.end());
}
bool
startsWith
(
const
std
::
string
&
_string
,
const
char
&
_prefix
)
bool
startsWith
(
const
std
::
string
&
_string
,
const
char
_prefix
)
{
if
(
_string
.
length
()
==
0
)
return
false
;
if
(
_string
[
0
]
==
_prefix
)
return
true
;
return
false
;
return
((
_string
.
length
()
>
0
)
&&
(
_string
[
0
]
==
_prefix
));
}
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
_string
,
char
_splitChar
,
bool
_skipEmptyStrings
)
...
...
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