Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Fred/String/StrFind.inl

Go to the documentation of this file.
00001 #ifndef __J2K__JString_Find_INL__
00002 #define __J2K__JString_Find_INL__
00003 
00004 #include <j2k/Fred/String/String.hpp>
00005 #include <string.h>
00006 #include <time.h>
00007 
00008 // Does NOT use external JString function
00009 
00010 // Instr missing (FindAt)
00011 
00012 inline long JString::Find( const JString& S ) const
00013 {
00014   return Find( S.parseString(), 0 );
00015 }
00016 
00017 inline long JString::Find( const JString& S, size_t sz ) const
00018 {
00019   return Find( S.parseString(), sz );
00020 }
00021 
00022 inline long JString::Find( char ch ) const
00023 {
00024   // find first single character
00025   // return -1 if not found and index otherwise
00026   for( size_t l = 0; l < pData->length; l++ ) {
00027     if ( pData->data[l] == ch ) return l;
00028   }
00029   return (-1);
00030 }
00031 
00032 inline long JString::ReverseFind( char ch ) const
00033 {
00034   // find last single character
00035   // return -1 if not found and index otherwise
00036 
00037   for( long l = (long)(pData->length - 1); l >= 0; l-- )
00038   {
00039     if ( pData->data[l] == ch )
00040     {
00041       return ( pData->length - l - 1 );
00042     }
00043   }
00044   return (-1);
00045 }
00046 
00047 inline long JString::Find( const char* s ) const
00048 {
00049   return Find( s, 0 );
00050 }
00051 
00052 inline JString  JString::getFind( const char* s )
00053 {
00054   return getFind( s, 0 );
00055 }
00056  
00057 #endif

Generated on Sun Oct 14 18:46:28 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001