-String::lastPos( const char* string ) const
-{
- int pos = 0;
- int length = strlen( string );
- if ( len() && length )
- {
- int nextpos = this->pos( string );
- while( nextpos )
- {
- pos += nextpos;
- nextpos = right( len() - pos - length + 1 ).pos( string );
- }
- }
- return pos;
-}
-
-// find c
-// return 0 if not found.
-
-// ? should return len()?, as in string.left(pos(delimiter))
-int
-String::pos(char c ) const
-{
- const char *me = data;
- int pos = 0;
- if ( len() )
- {
- const char* p = strchr( me, c );
- if ( p )
- pos = p - me + 1;
- }
- return pos;
+String::index_last (char const *string) const // UGK!
+{
+ assert (false); // broken
+ int len = strlen (string); // ugrh
+ if (!length () || !len)
+ return -1;
+
+ int next_i = index (string);
+ if (next_i == -1)
+ return -1;
+
+ int index_i = 0;
+ while (next_i >= 0)
+ {
+ index_i += next_i;
+ next_i = right_string (length () - index_i - len).index (string);
+ }
+ return index_i;