File: find_first_of.cc

package info (click to toggle)
nullmailer 1.00RC7-22
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,192 kB
  • ctags: 695
  • sloc: cpp: 4,375; sh: 519; makefile: 249; perl: 184; ansic: 10
file content (22 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "mystring.h"
#include <string.h>

int mystring::find_first_of(const char* setstr, size_t setlen,
			    size_t offset) const
{
  for(; offset < rep->length; offset++) {
    if(memchr(setstr, rep->buf[offset], setlen))
      return offset;
  }
  return -1;
}

int mystring::find_first_of(const char* setstr, size_t offset) const
{
  return find_first_of(setstr, strlen(setstr), offset);
}

int mystring::find_first_of(const mystring& setstr, size_t offset) const
{
  return find_first_of(setstr.rep->buf, setstr.rep->length, offset);
}