Logo Search packages:      
Sourcecode: pwlib version File versions

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.

string with leading and trailing spaces removed.

Definition at line 2230 of file contain.cxx.

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

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

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

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

Generated by  Doxygen 1.6.0   Back to index