Yep, missed files.

This commit is contained in:
Alexander S. Aganichev 2000-03-23 17:19:54 +00:00
parent 5b4f35d9ed
commit bdf98f9c7f
2 changed files with 16 additions and 6 deletions

View File

@ -25,17 +25,14 @@
// String manipulation functions.
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// Only include once!
#ifndef __GSTRALL_H
#define __GSTRALL_H
#ifndef __gstrall_h
#define __gstrall_h
// ------------------------------------------------------------------
// Required headers
#include <string>
#include <gctype.h>
#include <cstring>
#include <gdefs.h>
@ -73,6 +70,7 @@ char* strshr(char* str, int count);
char* strsrep(char* str, const char* search, const char* replace);
char* strltrim(char* str);
char* strtrim(char* str);
string& strtrim(string& p);
char* struplow(char* str);
char* longdotstr(long num); // Convert a long to a dotted string: xxx.xxx.xxx.xxx

View File

@ -451,6 +451,18 @@ char* strtrim(char* p) {
}
string& strtrim(string& p) {
if(not p.empty()) {
string::iterator trail = p.end();
while(trail != p.begin() and *(--trail) < '!') {}
if(*trail > ' ') trail++;
p.erase(trail, p.end());
}
return p;
}
// ------------------------------------------------------------------
// Trims leading spaces off of a string