免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 538 | 回复: 0
打印 上一主题 下一主题

c/c++ function [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-05-23 10:56 |只看该作者 |倒序浏览
strstr:
Syntax:
  
  #include
char *strstr( const char *str1, const char *str2 );
  
The function strstr() returns a pointer to the first occurrence
  of str2 in str1, or NULL if no
  match is found.  If the length of str2 is zero, then
  strstr() will simply return str1.
  
  
For example, the following code checks for the existence of one
  string within another string:
    char* str1 = "this is a string of characters";
  char* str2 = "a string";
  char* result = strstr( str1, str2 );
  if( result == NULL ) printf( "Could not find '%s' in '%s'\n", str2, str1 );
  else printf( "Found a substring: '%s'\n", result );
  
When run, the above code displays this output:
    Found a substring: 'a string of chara
    memchr:
  
  
    Syntax:
  
    #include
  void *memchr( const void *buffer, int ch, size_t count );
  
The memchr() function looks for the first occurrence of
  ch within count characters in the array pointed to
  by buffer. The return value points to the location of the
  first occurrence of ch, or NULL if
  ch isn't found. For example:
     char names[] = "Alan Bob Chris X Dave";
   
if( memchr(names,'X',strlen(names)) == NULL )
     
    printf( "Didn't find an X\n" );
   
else
     
    printf( "Found an X\n" );
memcmp:
    Syntax:
  
    #include
  int memcmp( const void *buffer1, const void *buffer2, size_t count );
  
The function memcmp() compares the first count characters
  of buffer1 and buffer2. The return values are as
  follows:
  
   
      Value
      Explanation
   
   
      less than 0
      buffer1 is less than buffer2
   
   
      equal to 0
      buffer1 is equal to buffer2
   
   
      greater than 0
      buffer1 is greater than buffer2
               
  
   Standard C String:
atof
      converts a string to a double
   
   
      
atoi
      converts a string to an
      integer
   
   
      
atol
      converts a string to a long
   
   
      
isalnum
      true if a character is
      alphanumeric
   
   
      
isalpha
      true if a character is
      alphabetic
   
   
      
iscntrl
      true if a character is a control
      character
   
   
      
isdigit
      true if a character is a digit
   
   
      
isgraph
      true if a character is a graphical
      character
   
   
      
islower
      true if a character is
      lowercase
   
   
      
isprint
      true if a character is a printing
      character
   
   
      
ispunct
      true if a character is
      punctuation
   
   
      
isspace
      true if a character is a space
      character
   
   
      
isupper
      true if a character is an uppercase
      character
   
   
      
isxdigit
      true if a character is a
      hexidecimal character
   
   
      
memchr
      searches an array for the first
      occurance of a character
   
   
      
memcmp
      compares two buffers
   
   
      
memcpy
      copies one buffer to another
   
   
      
memmove
      moves one buffer to another
   
   
      
memset
      fills a buffer with a
      character
   
   
      
strcat
      concatenates two strings
   
   
      
strchr
      finds the first occurance of a
      character in a string
   
   
      
strcmp
      compares two strings
   
   
      
strcoll
      compares two strings in accordance
      to the current locale
   
   
      
strcpy
      copies one string to another
   
   
      
strcspn
      searches one string for any
      characters in another
   
   
      
strerror
      returns a text version of a given
      error code
   
   
      
strlen
      returns the length of a given
      string
   
   
      
strncat
      concatenates a certain amount of
      characters of two strings
   
   
      
strncmp
      compares a certain amount of
      characters of two strings
   
   
      
strncpy
      copies a certain amount of
      characters from one string to another
   
   
      
strpbrk
      finds the first location of any
      character in one string, in another string
   
   
      
strrchr
      finds the last occurance of a
      character in a string
   
   
      
strspn
      returns the length of a substring
      of characters of a string
   
   
      
strstr
      finds the first occurance of a
      substring of characters
   
   
      
strtod
      converts a string to a double
   
   
      
strtok
      finds the next token in a
      string
   
   
      
strtol
      converts a string to a long
   
   
      
strtoul
      converts a string to an unsigned
      long
   
   
      
strxfrm
      converts a substring so that it can
      be used by string comparison functions
   
   
      
tolower
      converts a character to
      lowercase
   
   
      
toupper
      converts a character to
      uppercase
C/C++ Reference:http://www.cppreference.com/index.html
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/15867/showart_307660.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP