Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个字符串数组,例如:
char **strings = {"str1", "str2"};
我想知道 glib 中是否有一个函数来查找这个数组中字符串的位置。
我想我可以在 for() 循环中执行 g_strcmp0 ,但可能有更好的方法。
谢谢
您想要的功能不存在,因此您必须在 for 循环中执行此操作。如果您使用 aGList而不是数组,那么您可以使用g_list_index().
GList
g_list_index()