lib/mystring/find_last_ch.cc
changeset 0 6f7a81934006
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/mystring/find_last_ch.cc	Wed Jan 16 22:39:43 2008 +0100
@@ -0,0 +1,14 @@
+#include "mystring.h"
+
+int mystring::find_last(char ch, size_t offset) const
+{
+  if(offset == (size_t)-1)
+    offset = rep->length-1;
+  const char* ptr = rep->buf + offset;
+  while(ptr >= rep->buf) {
+    if(*ptr == ch)
+      return ptr - rep->buf;
+    --ptr;
+  }
+  return -1;
+}