lib/mystring/find_last_ch.cc
changeset 0 6f7a81934006
equal deleted inserted replaced
-1:000000000000 0:6f7a81934006
       
     1 #include "mystring.h"
       
     2 
       
     3 int mystring::find_last(char ch, size_t offset) const
       
     4 {
       
     5   if(offset == (size_t)-1)
       
     6     offset = rep->length-1;
       
     7   const char* ptr = rep->buf + offset;
       
     8   while(ptr >= rep->buf) {
       
     9     if(*ptr == ch)
       
    10       return ptr - rep->buf;
       
    11     --ptr;
       
    12   }
       
    13   return -1;
       
    14 }