有谁知道如何使用wcsstr
而不区分大小写?如果这一点很重要,我会在内核驱动中使用它。Wcsstr无区分大小写
回答
如果你在Windows下编程,你可以使用StrStrI()
函数。
你不能在内核驱动程序中使用它,所以你必须write it by your own。在该示例中,toupper()
被使用并应该被替换为RtlUpcaseUnicodeChar
(正如Rup指出的那样)。总结一下,你需要这样的东西:
char *stristr(const wchar_t *String, const wchar_t *Pattern)
{
wchar_t *pptr, *sptr, *start;
for (start = (wchar_t *)String; *start != NUL; ++start)
{
while (((*start!=NUL) && (RtlUpcaseUnicodeChar(*start)
!= RtlUpcaseUnicodeChar(*Pattern))))
{
++start;
}
if (NUL == *start)
return NULL;
pptr = (wchar_t *)Pattern;
sptr = (wchar_t *)start;
while (RtlUpcaseUnicodeChar(*sptr) == RtlUpcaseUnicodeChar(*pptr))
{
sptr++;
pptr++;
if (NUL == *pptr)
return (start);
}
}
return NULL;
}
['StrStrI'](http://msdn.microsoft.com/en-us/library/windows/desktop/bb773439.aspx)位于内核驱动程序无法使用的shlwapi中。但是,是的,你自己的代码可能是做的,尽管我怀疑'toupper'在这里也不可用。 – Rup 2012-03-12 12:57:30
其实我回过头来看 - 有['RtlUpcaseUnicodeChar'](http://msdn.microsoft.com/en-us/library/windows/hardware/ff563003.aspx) – Rup 2012-03-12 13:03:23
- 1. 区分大小写区分大小写还是全大写?
- 2. 区分大小写
- 3. 使区分大小写不敏感的区分大小写表
- 4. 区分大小写的URL不区分大小写
- 5. 区分大小写File.equals区分大小写的文件系统
- 6. VB.NET不区分大小写;很好的区分大小写?
- 7. Lucene如何区分大小写和不区分大小写
- 8. 为什么区分大小写和不区分大小写?
- 9. 区分大小写的区分大小写的
- 10. 不区分大小写
- 11. Arraylist.indexOf()区分大小写
- 12. 不区分大小写preg_replace_callback
- 13. Windows MySQL区分大小写
- 14. distinctUnionOfObjects不区分大小写
- 15. HTML区分大小写?
- 16. ATK4 Quicksearch区分大小写?
- 17. 区分大小写RLIKE
- 18. 区分大小写SSIS
- 19. Sqlite fts4区分大小写
- 20. 不区分大小写
- 21. Weblogic URI区分大小写
- 22. OData和区分大小写
- 23. System.IO.FileInfo不区分大小写
- 24. sAMAccountName和区分大小写
- 25. Mono IOMAP区分大小写
- 26. SQL BETWEEN区分大小写
- 27. 忽略区分大小写
- 28. MySQL不区分大小写
- 29. 不区分大小写Func
- 30. 不区分大小写#define
内核的什么部分应该对这个库函数调用做出响应? – 2012-03-12 12:20:24
有[一些](http://www.daniweb.com/software-development/c/code/216564)[示例](http://www.codeguru.com/cpp/cpp/string/article.php/c5641)如果您正确搜索。虽然我没有找到任何使用'whcar_t',它不应该很难修改它们来支持它。 – 2012-03-12 12:29:15