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

PINDEX PString::FindLast ( char  ch,
PINDEX  offset = P_MAX_INDEX 
) const [inherited]

Locate the position of the last matching character.

Parameters:
ch  Character to search for in string.
offset  Offset into string to begin search.

Definition at line 1984 of file contain.cxx.

References PString::GetLength().

Referenced by PString::FindLast(), PFilePath::GetDirectory(), PFilePath::GetFileName(), PDynaLink::GetName(), PFilePath::GetPath(), PFilePath::GetTitle(), PFilePath::GetType(), and PFilePath::SetType().

{
  PINDEX len = GetLength();
  if (len == 0 || offset < 0)
    return P_MAX_INDEX;
  if (offset >= len)
    offset = len-1;

  while (InternalCompare(offset, ch) != EqualTo) {
    if (offset == 0)
      return P_MAX_INDEX;
    offset--;
  }

  return offset;
}


Generated by  Doxygen 1.6.0   Back to index