C
[C] 219 문자열에서 알파벳만 추출 isalpha
qkrwngus
2021. 2. 6. 23:44
Desc :
Source Code :
#include <stdio.h>
#include <ctype.h>
void main()
{
char *string = "icecream: 1500";
char buff[20] = { 0, };
int i = 0;
while (*string)
{
if (isalpha(*string)) //문자열이 알파벳이면
{
buff[i++] = *string; // 추출
}
string++; // 다음문자
}
puts(buff);
}
Result :