Logo Search packages:      
Sourcecode: bglibs version File versions

int str_findprev ( const str s,
char  ch,
unsigned  pos 
)

Find the previous instance of the given character on or before pos

Definition at line 21 of file findprev.c.

References len, and s.

{
  char* p;
  if (pos >= s->len) pos = s->len - 1;
  for (p = s->s + pos; p >= s->s; --p)
    if (*p == ch) return p - s->s;
  return -1;
}


Generated by  Doxygen 1.6.0   Back to index