String building tip – concatenate two sub-strings

concatenate two sub-strings (str1 + str2) in Tizen, developer can use another more powerful string API, the eina_strbuf.h. (https://developer.tizen.org/documentation/guides/native-application/ui/eina/data-types)
Eina_Strbuf *strbuf = eina_strbuf_new();
eina_strbuf_append_printf(strbuf, "%s%s", str1, str2);
char *txt = eina_strbuf_string_steal(strbuf);
eina_strbuf_free(strbuf);
// txt manipulate goes here
free(txt); // remember to free the string after it isn’t needed anymore.

Responses

0 Replies