00001 #include <string> 00002 #include <vector> 00003 #include <stdio.h> 00004 00006 namespace str { 00007 00014 bool read_line(std::string *str, FILE *file = stdin, bool do_chomp = false); 00015 00022 bool read_string(std::string *str, size_t length, FILE *file = stdin); 00023 00030 bool read_file(std::string *str, FILE *file, size_t length = 0); 00031 00033 void chomp(std::string *str); 00034 00039 void clean(std::string *str, const char *chars); 00040 00052 void 00053 split(const std::string *str, const char *delims, bool group, 00054 std::vector<std::string> *fields, int num_fields = 0); 00055 00070 void 00071 split_with_quotes(std::string *str, const char *delims, bool group, 00072 std::vector<std::string> *fields); 00073 00080 long str2long(const char *str, bool *ok); 00081 double str2float(const char *str, bool *ok); 00082 long str2long(std::string *str, bool *ok); 00083 double str2float(std::string *str, bool *ok); 00085 };