/* wcsncmp example */ #include <stdio.h> #include <string.h> int main () { wchar_t wcs[][5] = { L"R2D2" , L"C3PO" , L"R2A6" }; int n; wprintf (L"Looking for R2 astromech droids...\n"); for (n=0 ; n<3 ; n++) if (wcsncmp (wcs[n],L"R2xx",2) == 0) { wprintf (L"found %ls\n",wcs[n]); } return 0; } |
Looking for R2 astromech droids... found R2D2 found R2A6 |
strncmp | 比较两个字符串中的字符(function ) |
wcsrchr | 定位宽字符串中某个最后出现的字符(function ) |
wcscmp | 比较两个字符串(function) |
wmemcmp | 比较两个宽字符块(function) |
wcsspn | 获取宽字符串在另一宽字符串中连续出现的字符数(function) |