mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 02:34:23 -05:00
docs: Clarify strlist_split
This commit is contained in:
@@ -87,8 +87,31 @@ General String Helper Functions
|
||||
|
||||
.. function:: char **strlist_split(const char *str, char split_ch, bool include_empty)
|
||||
|
||||
Splits a string in to a list of multiple sub-strings. Free with
|
||||
:c:func:`strlist_free()`.
|
||||
Splits a string in to a list of multiple sub-strings, terminated by
|
||||
``NULL``. If ``split_ch`` does not exist in the string, the first
|
||||
sub-string will be the same as ``str``. Free with :c:func:`strlist_free()`.
|
||||
|
||||
:param str: The string to be split
|
||||
:param split_ch: The delimiter
|
||||
:param include_empty: If *true*, empty strings caused by having the
|
||||
``split_ch`` right next to another will be
|
||||
included in the list. If *false*, they won't
|
||||
be included.
|
||||
|
||||
Sample usage:
|
||||
|
||||
.. code:: cpp
|
||||
|
||||
char **words = strlist_split("OBS Studio", ' ', false);
|
||||
int count = 0;
|
||||
|
||||
for (char **word = words; *word; ++word) {
|
||||
count++;
|
||||
blog(LOG_DEBUG, "%s", *word);
|
||||
}
|
||||
|
||||
strlist_free(words);
|
||||
// count == 2
|
||||
|
||||
----------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user