20 std::string::iterator it = line.begin();
21 while ( it!=line.end() ) {
44 unsigned char uch = ch;
71 unsigned char ch = (*p);
96 std::string::iterator p = str.begin();
97 while ( p!=str.end() ) {
102 unsigned char ch = (*p);
122 unsigned len = word.length();
123 if ( len == 0 ) {
return; }
125 if ( word[len]==
'\"' || word[len]==
'\'' ) { --len; }
128 if ( word[0]==
'\"' || word[0]==
'\'' ) { ++from; --len; }
130 word = word.substr( from, len );
141 std::string::const_iterator it = line.begin();
142 while ( it!=line.end() ) {
143 if ( !
isalpha(*it) ) {
return false; }
158 std::string::const_iterator it = word.begin();
159 while ( isspace(*it) ) {
162 return (it == word.end() );
172 bool issuffix(
const char* str,
const char* suffix ) {
174 bool check_null = (suffix==0);
175 if (!check_null) { check_null = (*suffix==0); }
176 if (check_null) {
return true; }
179 bool check_null = (str==0);
180 if (!check_null) { check_null = (*str==0); }
181 if (check_null) {
return false; }
185 unsigned str_len = strlen( str );
186 unsigned suffix_len = strlen( suffix );
188 if ( str_len < suffix_len ) {
return false; }
190 const char *p = str+str_len;
191 const char *q = suffix+suffix_len;
195 }
while ( q!=suffix );
210 unsigned N=str.length();
211 if ( (i>=N) ) {
return std::string::npos; }
214 if ( !isdigit(str[i]) ) {
return n; }
230 unsigned N=str.length();
231 if ( (i>=N) ) {
return std::string::npos; }
234 if ( !
isalpha(str[i]) ) {
return n; }
249 if ( str.empty() ) {
return std::string::npos; }
250 unsigned i = str.size()-1;
251 if ( !isdigit(str[i]) ) {
return std::string::npos; }
257 if ( !isdigit(ch) ) {
break;}
259 if ( i==0 ) {
break; }
276 unsigned N=str.length();
278 if ( isspace(str[i]) ) { ++i; }
281 if ( i==N ) {
return 0; }
282 if ( str[i]==
'-' || str[i]==
'+' ) { ++i; }
283 if ( i==N ) {
return 0; }
288 if ( !isdigit(str[i]) ) {
break; }
290 n = nMult + (str[i]-
'0');
304 std::string
tostring(
unsigned N,
unsigned width ) {
305 if ( width==0 ) {
return std::string(); }
307 std::string ret; ret.resize( width );
325 void tostring(
unsigned N,
unsigned width,
char *str ) {
326 if ( width==0 ) { *str = 0;
return; }
348 void tokens(
const std::string& renglon, std::list<std::string>& L,
const char* delimiters ) {
354 size_t next = renglon.find_first_of( delimiters, current );
355 while (next != std::string::npos) {
356 if (
' ' == renglon[current] ) {
359 else if ( current==next ) {
360 L.push_back( renglon.substr(current,(1) ) );
365 L.push_back( renglon.substr(current,(next-current) ) );
369 next = renglon.find_first_of( delimiters, current );
371 if ( current < renglon.size() ) {
372 L.push_back( renglon.substr(current,(std::string::npos) ) );
384 char *
strdel(
char *str,
size_t from,
size_t len) {
385 size_t slen = strlen(str);
387 if (from >= slen) {
return str; }
388 if (from+len > slen) { len = slen-from; }
389 memmove( str+(from), str+(from+len), slen-(from+len)+1 );
408 size_t slen = strlen(str);
410 if (len > slen) { len = slen; }
411 memmove( str, str+len, slen-len+1 );