home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / 1991 / 10 / string / strifunc.cpp < prev    next >
C/C++ Source or Header  |  1991-07-30  |  391b  |  18 lines

  1. #include <string.h>
  2. #include <ctype.h>
  3. #include <errno.h>
  4. #include <string.hpp>
  5.  
  6. String String::operator()(int start, int len)
  7. {
  8.     if (len < 0 || start < 0 || start >= length()) {
  9.         errno = ERANGE;
  10.         String t;
  11.         return t;
  12.     } else {
  13.         if (length()-start < len) len = length()-start;
  14.         String t(body()+start, len);
  15.         return t;
  16.     }
  17. }
  18.