16 lines
379 B
C
16 lines
379 B
C
|
// sscanf() 高级用法: 跳过空格
|
||
|
// 遇到空格则跳过
|
||
|
#include <stdio.h>
|
||
|
#include <stdlib.h>
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
char *content = "disen 17791692095,610039018";
|
||
|
char phone[12] = "";
|
||
|
// *s 表示跳过空格, 11s 表示读取11个字符
|
||
|
sscanf(content, "%*s%11s", phone);
|
||
|
// sscanf(content, "%*[a-z]%11s", phone);
|
||
|
printf("%s\n", phone);
|
||
|
|
||
|
return 0;
|
||
|
}
|