Created
February 8, 2017 20:46
-
-
Save codingdave/27b12fd2be9421f539d130ec6c9d9173 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gchar *_string_get_next_variable(gchar *string, gchar *variable, const size_t max_variable_size) | |
{ | |
gchar *end = NULL; | |
gchar *start = g_strstr_len(string, max_variable_size, "$("); | |
if(start) | |
{ | |
end = g_strstr_len(start, max_variable_size, ")"); | |
if(end) | |
{ | |
const int length = end - start + 2; | |
g_strlcpy(variable, start, length); | |
// the string in variable is null terminated | |
end++; | |
} | |
} | |
// fprintf(stderr, "_string_get_next_variable: splitted %s in variable %s and remainder %s\n", string, variable, | |
// end); | |
return end; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment