Gum String Utils

Gum String Utils — Utility functions for strings handling

Functions

Object Hierarchy


Includes

#include <gum/common/gum-string-utils.h>

Description

String utility functions

Functions

GUM_STR_FREE()

#define             GUM_STR_FREE(s)

A helper macro that frees the string after checking if it is not NULL.

Parameters

s

the string to free

 

GUM_STR_DUP()

#define             GUM_STR_DUP(s, d)

A helper macro that duplicates source string to destination string after freeing the destination string first if it is not NULL.

Parameters

s

the source string

 

d

the destination string

 

GUM_STR_FREEV()

#define             GUM_STR_FREEV(s)

A helper macro that frees string vector after checking if it is not NULL.

Parameters

s

the string vector to free

 

GUM_STR_DUPV()

#define             GUM_STR_DUPV(s, d)

A helper macro that duplicates source string vector to destination string vector after freeing the destination string vector first if it is not NULL.

Parameters

s

the source string vector

 

d

the destination string vector

 

gum_string_utils_search_string ()

gboolean
gum_string_utils_search_string (const gchar *strings,
                                const gchar *separator,
                                const gchar *search_str);

Finds the 'search string' in the strings.

Parameters

strings

concatenated strings in a string placeholder separated by a separator.

[transfer none]

separator

separator between strings.

[transfer none]

search_str

string to search.

[transfer none]

Returns

TRUE if found, FALSE otherwise.


gum_string_utils_search_stringv ()

gboolean
gum_string_utils_search_stringv (gchar **stringv,
                                 const gchar *search_str);

Finds the 'search string' in the string vector.

Parameters

stringv

vector of strings.

[transfer none]

search_str

string to search.

[transfer none]

Returns

TRUE if found, FALSE otherwise.


gum_string_utils_get_string ()

gchar *
gum_string_utils_get_string (const gchar *strings,
                             const gchar *separator,
                             guint str_ind);

Gets the str_ind'th string from the strings.

Parameters

strings

vector of strings.

[transfer none]

separator

separator between strings.

[transfer none]

str_ind

starting from 0, position for the string to fetch

 

Returns

string if successful, NULL otherwise.

[transfer full]


gum_string_utils_insert_string ()

gchar *
gum_string_utils_insert_string (const gchar *strings,
                                const gchar *separator,
                                const gchar *str_to_insert,
                                guint str_ind,
                                guint total_strings);

Inserts the string at the desired position and returns the concatenated string

Parameters

strings

vector of strings.

[transfer none]

separator

separator between strings.

[transfer none]

str_to_insert

string to insert.

[transfer none]

str_ind

starting from 0, position for the string to insert

 

total_strings

total number of strings in the strings vector

 

Returns

concatenated string vector if successful, NULL otherwise.

[transfer full]


gum_string_utils_delete_string ()

gchar **
gum_string_utils_delete_string (gchar **src_strv,
                                const gchar *string);

Deletes the string from the strings' vector.

Parameters

src_strv

vector of strings.

[transfer none]

string

string to delete.

[transfer none]

Returns

modified string vector if string found, NULL otherwise.

[transfer full]


gum_string_utils_append_string ()

gchar **
gum_string_utils_append_string (gchar **src_strv,
                                const gchar *string);

Appends the string to the end of the strings' vector.

Parameters

src_strv

vector of strings.

[transfer none]

string

string to append.

[transfer none]

Returns

concatenated string vector if successful, NULL otherwise.

[transfer full]

Types and Values