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

PString PString::RightTrim (  ) const [inherited]

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

Returns:
string with trailing spaces removed.

Definition at line 2217 of file contain.cxx.

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

{
  char * rpos = theArray+GetLength()-1;
  if (isspace(*rpos & 0xff))
    return *this;

  while (isspace(*rpos & 0xff)) {
    if (rpos == theArray)
      return Empty();
    rpos--;
  }

  // make Apple & Tornado gnu compiler happy
  PString retval(theArray, rpos - theArray + 1);
  return retval;
}

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index