开发者

Find the position of a string in an array of string with the GLib

I have an array of string, like:

char **strings = {"str1", "str2"};

And i would like to know if there is a function in the glib to find the position of a string in this array.

I guess i could just do g_strcmp0 in a for() loop, but there ma开发者_运维技巧y be a better way to do it.

Thanks


The function you want does not exist, so you'll have to do it in a for-loop. If you used a GList instead of an array, then you could use g_list_index().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜