Mã:
int MakeAllowed(char* in_data, char *out_data, const char* no_Allowed)
{
printf(no_Allowed);
CString zsTemp(in_data);
int first = -1;
int itemPos = 0;
int item = 0;
char *tempbuf =(char*) _alloca(sizeof(TCHAR));
first = zsTemp.FindOneOf(no_Allowed);
_tcsnset(tempbuf, zsTemp.GetAt(first-1), 1);
tempbuf[1] = '\0';
while(first!=-1)
{
_tcsnset(tempbuf, zsTemp.GetAt(first-1), 1);
printf("
Char find: %s",tempbuf);
zsTemp.Replace(first - 1, (LPCTSTR)tempbuf,"");
first = zsTemp.FindOneOf(no_Allowed);
item++;
}
int jj = zsTemp.GetLength();
memcpy(out_data, zsTemp.GetData(), jj);
out_data[jj] = '\0';
return jj;
}
Cách dùng:
char str[]="A/B|C:S<V>MDEFbcdt>oo";
MakeAllowed(inStr, outStr, "<>|:");
outStr: ABCSVMDEFbcdtoo
View more random threads:
Với sự đa dạng và phong phú về mẫu mã và giá cả, choxeonline.vn hứa hẹn sẽ là địa chỉ tin cậy cho những ai đang tìm kiếm chiếc xe ô tô ưng ý. Từ những mẫu xe hạng sang đến những chiếc xe gia đình...
Khám Phá Đa Dạng Sản Phẩm Xe Ô Tô...