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

PString PString::operator() ( PINDEX  start,
PINDEX  end 
) const [inherited]

Extract a portion of the string into a new string. The original string is not changed and a new unique reference to a string is returned.

The substring is returned inclusive of the characters at the start# and end# positions.

If the end# position is greater than the length of the string then all characters from the start# up to the end of the string are returned.

If start# is greater than the length of the string or end# is before start# then an empty string is returned.

substring of the source string.
startStarting position of the substring.
endEnding position of the substring.

Definition at line 1791 of file contain.cxx.

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

Referenced by PFilePath::GetPath(), PFilePath::GetTitle(), PFilePath::GetType(), PString::Lines(), PString::Mid(), and PString::Tokenise().

  if (end < 0 || start < 0 || end < start)
    return Empty();

  register PINDEX len = GetLength();
  if (start > len)
    return Empty();

  if (end >= len) {
    if (start == 0)
      return *this;
    end = len-1;
  len = end - start + 1;

  return PString(theArray+start, len);

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