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.
是否有任何函数可以在 GLib 中获取子字符串?
就像是
gchar *getSlice(const gchar *text, gint startIndex);
你可以这样做:
gchar *s = &text[start_index];
如果您想要子字符串的副本,请执行
gchar *s = g_strdup(&text[start_index]);
在后一种情况下,请记住在完成后释放字符串。