Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
c7f37a64
Commit
c7f37a64
authored
Oct 05, 2020
by
Oliver Heidmann
Browse files
added string tokenizer funtion that converts char * to a vector of c++ string tokens
parent
ddd5d82e
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/string_utilities.cc
View file @
c7f37a64
...
...
@@ -14,6 +14,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#include
<algorithm>
#include
"cdo_output.h"
#include
"dmemory.h"
...
...
@@ -22,6 +23,17 @@
#define DBG 0
int
cstrSplitWithSeperator
(
const
char
*
source_string
,
const
char
*
seperator
,
std
::
vector
<
std
::
string
>
&
split_string
)
{
std
::
stringstream
ss
(
source_string
);
std
::
string
token
;
while
(
std
::
getline
(
ss
,
token
,
*
seperator
))
{
split_string
.
push_back
(
token
);
}
return
split_string
.
size
();
}
int
cstrSplitWithSeperator
(
const
char
*
source_string
,
const
char
*
seperator
,
char
***
ptr_split_string
)
{
...
...
src/string_utilities.h
View file @
c7f37a64
...
...
@@ -17,14 +17,14 @@
#ifndef STR_UTILITIES_H
#define STR_UTILITIES_H
int
cstrSplitWithSeperator
(
const
char
*
source_string
,
const
char
*
seperator
,
std
::
vector
<
std
::
string
>
&
split_string
);
int
cstrSplitWithSeperator
(
const
char
*
source_string
,
const
char
*
seperator
,
char
***
ptr_split_string
);
int
cstrIsNumeric
(
const
char
*
s
);
void
cstr
ToUpperCase
(
char
*
sPt
r
);
void
cstr
ReplaceChar
(
char
*
str_in
,
char
orig_char
,
char
rep_cha
r
);
void
cstrToUpperCase
(
char
*
sPtr
);
void
cstrToLowerCase
(
char
*
sPtr
);
void
cstrReplaceChar
(
char
*
str_in
,
char
orig_char
,
char
rep_char
);
#endif
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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