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

C:/temp/src/j2k/Deprecated/old_18mar_diff/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( char ch ) const {
00013   // find first single character
00014   // return -1 if not found and index otherwise
00015   for( size_t l = 0; l < pData->length; l++ ) {
00016     if ( pData->data[l] == ch ) return l;
00017   }
00018   return (-1);
00019 }
00020 
00021 inline long JString::ReverseFind( char ch ) const {
00022   // find last single character
00023   // return -1 if not found and index otherwise
00024 
00025   for( size_t l = (pData->length - 1); l >= 0; l-- ) {
00026     if ( pData->data[l] == ch ) return ( pData->length - l - 1 );
00027   }
00028   return (-1);
00029 }
00030 
00031 inline long JString::Find( const char* s ) const {
00032   return Find( s, 0 );
00033 }
00034 
00035 inline JString  JString::getFind( const char* s ) {
00036   return getFind( s, 0 );
00037 }
00038  
00039 #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