Commit c7f37a64 authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added string tokenizer funtion that converts char * to a vector of c++ string tokens

parent ddd5d82e
......@@ -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)
{
......
......@@ -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 cstrToUpperCase(char *sPtr);
void cstrReplaceChar(char *str_in, char orig_char, char rep_char);
void cstrToUpperCase(char *sPtr);
void cstrToLowerCase(char *sPtr);
void cstrReplaceChar(char *str_in, char orig_char, char rep_char);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment