Logo Search packages:      
Sourcecode: pwlib version File versions  Download package

PString PString::Trim (  ) const [inherited]

Create a string consisting of all characters from the source string except all spaces at the beginning and end of the string. The original string is not changed and a new unique reference to a string is returned.

Returns:
string with leading and trailing spaces removed.

Definition at line 2235 of file contain.cxx.

References PString::Empty(), PString::GetLength(), and PString::PString().

Referenced by PSMTPServer::OnSendMail().

{
  const char * lpos = theArray;
  while (isspace(*lpos & 0xff))
    lpos++;
  if (*lpos == '\0')
    return Empty();

  const char * rpos = theArray+GetLength()-1;
  if (!isspace(*rpos & 0xff))
    return PString(lpos);

  while (isspace(*rpos & 0xff))
    rpos--;
  return PString(lpos, rpos - lpos + 1);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index