home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / STRPBRK.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.8 KB  |  50 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - strpbrk.c
  3.  *
  4.  * function(s)
  5.  *        strpbrk - scans a string for the first occurrence of
  6.  *                any character a given set
  7.  *-----------------------------------------------------------------------*/
  8.  
  9. /*[]------------------------------------------------------------[]*/
  10. /*|                                                              |*/
  11. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  12. /*|                                                              |*/
  13. /*|                                                              |*/
  14. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  15. /*|     All Rights Reserved.                                     |*/
  16. /*|                                                              |*/
  17. /*[]------------------------------------------------------------[]*/
  18.  
  19. #include <string.h>
  20.  
  21. /*---------------------------------------------------------------------*
  22.  
  23. Name            strpbrk - scans a string for the first occurrence of
  24.               any character a given set
  25.  
  26. Usage           char *strpbrk(const char *str1, const char *str2);
  27.  
  28. Prototype in    string.h
  29.  
  30. Description    strpbrk scans a string, str1, for the first occurrence of any
  31.         character appearing in str2.
  32.  
  33. Return value    strpbrk    returns a pointer to the first occurrence of any of
  34.         the characters in str2; if none of the str2 characters occurs
  35.         in str1, it returns NULL.
  36.  
  37. *---------------------------------------------------------------------*/
  38. char *strpbrk(const char *s1, const char *s2)
  39. {
  40.     register const char *srchs2;
  41.  
  42.     while (*s1)
  43.     {
  44.         for (srchs2 = s2; *srchs2; srchs2++)
  45.             if (*s1 == *srchs2) return((char *)s1);
  46.         s1++;
  47.     }
  48.     return (0);
  49. }
  50.