- 论坛徽章:
- 0
|
这是个字符串转小写的函数,哪个static char的是个L,我的editplus里看起来和1查不多,晕四了,很奇怪那句转的过程,莫非有什么深意?
- Function codes
- ---------------------------------------------------------------------------*/
- /*-------------------------------------------------------------------------*/
- /**
- @brief Convert a string to lowercase.
- @param s String to convert.
- @return ptr to statically allocated string.
- This function returns a pointer to a statically allocated string
- containing a lowercased version of the input string. Do not free
- or modify the returned string! Since the returned string is statically
- allocated, it will be modified at each function call (not re-entrant).
-
- */
- /*--------------------------------------------------------------------------*/
- char * strlwc(char * s)
- {
- static char l[ASCIILINESZ+1];
- int i ;
- if (s==NULL) return NULL ;
- memset(l, 0, ASCIILINESZ+1);
- i=0 ;
- while (s[i] && i<ASCIILINESZ) {
- l[i] = (char)tolower((int)s[i]);
- //不知道这为什么要(int),s[i]如果是字母,那怎么int?
- i++ ;
- }
- l[ASCIILINESZ]=(char)0;
- return l ;
- }
复制代码 |
|