(file) Return to String.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/String.cpp between version 1.5 and 1.6

version 1.5, 2001/03/09 19:49:32 version 1.6, 2001/04/09 20:18:47
Line 23 
Line 23 
 // Author: // Author:
 // //
 // $Log$ // $Log$
   // Revision 1.6  2001/04/09 20:18:47  karl
   // add find substring function
   //
 // Revision 1.5  2001/03/09 19:49:32  karl // Revision 1.5  2001/03/09 19:49:32  karl
 // long lines // long lines
 // //
Line 42 
Line 45 
 // //
 //END_HISTORY //END_HISTORY
  
   
 #include <cctype> #include <cctype>
 #include "String.h" #include "String.h"
 #include "Exception.h" #include "Exception.h"
 #include "String.h" #include "String.h"
  
   // For debugging
   // #include <iostream>
   //using namespace std;
   
   
 PEGASUS_NAMESPACE_BEGIN PEGASUS_NAMESPACE_BEGIN
  
 const String String::EMPTY; const String String::EMPTY;
Line 316 
Line 325 
     return Uint32(-1);     return Uint32(-1);
 } }
  
   Uint32 String::find(String& s) const
   {
       // const Char16* first = getData();
       const Char16* ps = s.getData();
   
       // If find first substr char
       Uint32 loc;
       if ((loc = find(*ps)) != -1)
       {
           // Set p = Point to next char.
           // Note we retest first char.
           const Char16* p = getData() + loc;
   
           // Get length of substring
           Uint32 n = s.getLength();
   
           // No match if substr longer than remaining string
           if ((loc + n) > getLength())
               return Uint32(-1);
   
           // Test remaining char for equal
           for (Uint32 i = 0; n > i; i++)
               if (*p++ != *ps++ )
                   return Uint32(-1);
       }
       return loc;
   }
   // ATTN:KS 5 apr 2000 Need to add the Char16* version.
   Uint32 String::find(const char* s) const
   {
       return find(String(s));
   }
   
 Uint32 String::reverseFind(Char16 c) const Uint32 String::reverseFind(Char16 c) const
 { {
     const Char16* first = getData();     const Char16* first = getData();


Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2