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

PString PString::Mid ( PINDEX  start,
PINDEX  len = P_MAX_INDEX 
) 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.

A substring from the start# position for the number of characters specified is extracted.

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

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

Returns:
substring of the source string.
Parameters:
start  Starting position of the substring.
len  Number of characters to extract.

Definition at line 1836 of file contain.cxx.

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

Referenced by PRegularExpression::EscapeString(), PFilePath::GetFileName(), PHTTPField::GetHTMLInput(), PPOP3Client::GetMessageSizes(), PDirectory::GetPath(), PPOP3Client::OnOpen(), PSMTPServer::OnSendMail(), PArgList::Parse(), PIpAccessControlEntry::Parse(), PInternetProtocol::ParseResponse(), PPOP3::ParseResponse(), PHTTP::ParseResponse(), PPOP3Server::ProcessCommand(), PInternetProtocol::ReadCommand(), PInternetProtocol::ReadResponse(), PRemoteConnection::SetConfiguration(), and PSTUNClient::SetServer().

{
  if (len <= 0 || start < 0)
    return Empty();

  if (start+len < start) // Beware of wraparound
    return operator()(start, P_MAX_INDEX);
  else
    return operator()(start, start+len-1);
}


Generated by  Doxygen 1.6.0   Back to index