string-search

stripos returns false when special characters is used

点点圈 提交于 2019-11-26 22:03:30
问题 I am using the stripos function to check if a string is located inside another string, ignoring any cases. Here is the problem: stripos("ø", "Ø") returns false. While stripos("Ø", "Ø") returns true. As you might see, it looks like the function does NOT do a case- insensitive search in this case. The function has the same problems with characters like Ææ and Åå. These are Danish characters. 回答1: Use mb_stripos() instead. It's character set aware and will handle multi-byte character sets.

Search for selection in vim

你。 提交于 2019-11-26 05:16:59
问题 I use vim and vim plugins for visual studio when writing C++. Often, I find myself wanting to search for a string within a function, for example every call to object->public_member.memberfunc() . I know vim offers a convenient way to search for a single word, by pressing * and # , and it can also search for typed strings using the ubiquitous slash / command. When trying to search for all the instances of a longer string like the one above, it takes a while to re-type after / . Is there a way