to 함수
각각의 에 함수 및 해당 연결 된 매크로 변환 단일 문자에 다른 문자.
|
설명
해당 에 함수와 변환 매크로 다음과 같습니다.
루틴 |
매크로 |
설명 |
---|---|---|
__toascii |
__toascii |
변환 c ASCII 문자 |
tolower |
tolower |
변환 c 적절 한 경우 소문자로 |
_tolower |
_tolower |
변환 c 를 소문자로 |
towlower |
없음 |
변환 c 에 해당 와이드 문자 소문자 |
toupper |
toupper |
변환 c 적절 한 경우 대문자로 |
_toupper |
_toupper |
변환 c 를 대문자로 |
towupper |
없음 |
C 해당 와이드 문자 대문자 문자 변환 |
함수 버전을 사용 하 여 에 매크로 정의를 제거 루틴을 또한 매크로로 정의 됩니다 #undef 지시문 또는 CTYPE를 포함 하지 않습니다.H./Za 컴파일러 옵션을 사용 하는 경우 컴파일러가 함수 버전을 사용 하 여 toupper 또는 tolower.선언에는 toupper 및 tolower 함수는 STDLIB에서.H.
__toascii 의 하위 7 비트 하지만 모든 루틴 집합 c 0으로 변환 된 값에 ASCII 문자 집합을 나타냅니다.경우 c 이미 ASCII 문자를 나타내는 c 는 변경 되지 않습니다.
The tolower and toupper routines:
에 의존 하는 있는 LC_CTYPE 현재 로케일 범주 (tolower 호출 isupper 및 toupper 호출 islower).
변환 c 경우 c 가 해당 로케일에 대 한 현재 로케일에 적절 한 사례와는 반대 경우 변환할 수 있는 문자를 나타냅니다.그렇지 않으면 c 는 변경 되지 않습니다.
The _tolower and _toupper routines:
로캘 독립적, 훨씬 더 빠른 버전의 tolower 및 toupper.
Can be used only when isascii(c) and either isupper(c) or islower(c), respectively, are nonzero.
결과 경우 정의 되지 않은 한 c 는 ASCII 문자를 변환 하기 위한 적절 한 대/소문자를 아닙니다.
towlower 및 towupper 함수 변환 된 복사본을 반환 합니다. c 다음 조건 모두에 0이 된 경우에 합니다.그렇지 않으면 c 는 변경 되지 않습니다.
c적절 한 케이스의 와이드 문자입니다 (즉,입니다 iswupper 또는 iswlower, 각각이 아닌).
해당 너비 문자가 대상 케이스 (즉,입니다 iswlower 또는 iswupper, 각각 0이 아닌).
예제
// crt_toupper.c
/* This program uses toupper and tolower to
* analyze all characters between 0x0 and 0x7F. It also
* applies _toupper and _tolower to any code in this
* range for which these functions make sense.
*/
#include <ctype.h>
#include <string.h>
char msg[] = "Some of THESE letters are Capitals.";
char *p;
int main( void )
{
printf( "%s\n", msg );
/* Reverse case of message. */
for( p = msg; p < msg + strlen( msg ); p++ )
{
if( islower( *p ) )
putchar( _toupper( *p ) );
else if( isupper( *p ) )
putchar( _tolower( *p ) );
else
putchar( *p );
}
}