Adds a copy of string to the glib.StringChunk, unless the same string has already been added to the glib.StringChunk with StringChunk.insertConst.

This function is useful if you need to copy a large number of strings but do not want to waste space storing duplicates. But you must remember that there may be several pointers to the same string, and so any changes made to the strings should be done very carefully.

Note that StringChunk.insertConst will not return a pointer to a string added with StringChunk.insert, even if they do match.

class StringChunk
string string_


string_ string

the string to add

Return Value

Type: string

a pointer to the new or existing copy of string within the glib.StringChunk