0
我想提取的“/”油嘴串效用函数(echivalent为strcspn)
例如第一次出现之后的存在的字符串一个具有一个char *卡在这种形式中的一种:
hw:0/Line
default/Master
,我需要的char *通道(线路,硕士,...)
在标准C可以用 “strcspn” 和 “strlen的”
char *card, *channel;
int i;
i = strcspn(card, "/");
if (i == strlen(card)) {
channel = "Master";
} else {
card[i] = 0;
channel = card + i + 1;
}
如何使用glib字符串实用程序函数执行此操作?