#include <StringParse.h>
Definition at line 19 of file StringParse.h.
◆ StringParse() [1/2]
StringParse::StringParse |
( |
std::string | input | ) |
|
Definition at line 17 of file StringParse.cxx.
17 {
18 m_past_end="?!?";
19 m_lstring=input;
20 m_nword=0;
21 std::string::size_type pos=0;
22 std::string::size_type prev_pos=0;
23 while((pos=input.find_first_of(' ',pos)) != std::string::npos){
24 m_lsubstring.push_back(input.substr(prev_pos,pos-prev_pos));
25 prev_pos=++pos;
26 }
27
28 m_lsubstring.push_back(input.substr(prev_pos,pos-prev_pos));
29 m_nword=m_lsubstring.size();
30}
◆ StringParse() [2/2]
StringParse::StringParse |
( |
| ) |
|
◆ ~StringParse()
StringParse::~StringParse |
( |
| ) |
|
◆ intpiece()
int StringParse::intpiece |
( |
const int & | num | ) |
|
Definition at line 39 of file StringParse.cxx.
39 {
41 int i= atoi(m_lsubstring[
num-1].
c_str());
42 return i;
43 }
44 else {
45 return -1;
46 }
47}
◆ longpiece()
long StringParse::longpiece |
( |
const int & | num | ) |
|
Definition at line 48 of file StringParse.cxx.
48 {
50 int i= atol(m_lsubstring[
num-1].
c_str());
51 return i;
52 }
53 else {
54 return -1;
55 }
56}
◆ numpiece()
float StringParse::numpiece |
( |
const int & | num | ) |
|
Definition at line 57 of file StringParse.cxx.
57 {
59 float x= atof(m_lsubstring[
num-1].
c_str());
61 }
62 else {
63 return -1.1;
64 }
65}
◆ piece()
std::string StringParse::piece |
( |
const int & | num | ) |
|
Definition at line 31 of file StringParse.cxx.
31 {
33 return m_lsubstring[
num-1];
34 }
35 else {
36 return m_past_end;
37 }
38}
◆ string_size()
unsigned StringParse::string_size |
( |
void | | ) |
const |
|
inline |
The documentation for this class was generated from the following files: