C tolower() 대문자를 소문자로 변환 함수
인수로 받은 문자가 대문자이면 소문자로 변환하여 반환합니다. 인수가 대문자가 아니면 그대로 반환합니다.
- 헤더: ctype.h
- 형태: int tolower( int c)
- 인수: int c - 변환할 문자
- 반환: c가 대문자일 때만 소문자로 변환하여 반환하고, 대문자가 아니라면 그대로 반환
C언어 tolower() 함수 예제
#include <stdio.h>
#include <ctype.h>
int main( void)
{
char str[] = "0xAF1Agh!@#";
int ndx;
for ( ndx= 0; ndx < strlen( str); ndx++){
str[ndx] = (char)tolower( str[ndx]);
}
printf( "%s\n", str);
return 0;
}
C언어 tolower() 예제 실행 결과
]$ ./a.out
0xaf1agh!@#
]$
'컴퓨터 > 프로그래밍' 카테고리의 다른 글
C언어 strcasecmp 함수 대소문자 무시하고 문자열 비교 (0) | 2020.03.10 |
---|---|
C언어 toupper 함수 소문자를 대문자로 변환 (0) | 2020.03.10 |
C언어 isxdigit 함수 문자가 16진수 수치 문자인지 판별 (0) | 2020.03.10 |