![]() |
![]() |
![]() |
![]() |
<GString>
(define-values (%return) (string:append self val))
Adds a string onto the end of a GString, expanding it if necessary.
(define-values (%return) (string:append-c self c))
Adds a byte onto the end of a GString, expanding it if necessary.
(define-values (%return) (string:append-len self val len))
Appends len
bytes of val
to string
.
If len
is positive, val
may contain embedded nuls and need
not be nul-terminated. It is the caller's responsibility to
ensure that val
has at least len
addressable bytes.
If len
is negative, val
must be nul-terminated and len
is considered to request the entire string length. This
makes g_string_append_len()
equivalent to g_string_append()
.
(define-values (%return) (string:append-unichar self wc))
Converts a Unicode character into UTF-8, and appends it to the string.
(define-values (%return) (string:append-uri-escaped self unescaped reserved-chars-allowed allow-utf8))
Appends unescaped
to string
, escaping any characters that
are reserved in URIs using URI-style escape sequences.
(define-values (%return) (string:ascii-down self))
Converts all uppercase ASCII letters to lowercase ASCII letters.
(define-values (%return) (string:ascii-up self))
Converts all lowercase ASCII letters to uppercase ASCII letters.
(define-values (%return) (string:assign self rval))
Copies the bytes from a string into a GString,
destroying any previous contents. It is rather like
the standard strcpy()
function, except that you do not
have to worry about having enough space to copy the string.
(define-values (%return) (string:equal? self v2))
Compares two strings for equality, returning TRUE
if they are equal.
For use with GHashTable.
(define-values (%return) (string:erase self pos len))
Removes len
bytes from a GString, starting at position pos
.
The rest of the GString is shifted down to fill the gap.
(define-values (%return) (string:free self free-segment))
Frees the memory allocated for the GString.
If free_segment
is TRUE
it also frees the character data. If
it's FALSE
, the caller gains ownership of the buffer and must
free it after use with g_free()
.
(define-values (%return) (string:free-to-bytes self))
Transfers ownership of the contents of string
to a newly allocated
GBytes. The GString structure itself is deallocated, and it is
therefore invalid to use string
after invoking this function.
Note that while GString ensures that its buffer always has a trailing nul character (not reflected in its "len"), the returned GBytes does not include this extra nul; i.e. it has length exactly equal to the "len" member.
(define-values (%return) (string:hash self))
Creates a hash code for str
; for use with GHashTable.
(define-values (%return) (string:insert self pos val))
Inserts a copy of a string into a GString, expanding it if necessary.
(define-values (%return) (string:insert-c self pos c))
Inserts a byte into a GString, expanding it if necessary.
(define-values (%return) (string:insert-len self pos val len))
Inserts len
bytes of val
into string
at pos
.
If len
is positive, val
may contain embedded nuls and need
not be nul-terminated. It is the caller's responsibility to
ensure that val
has at least len
addressable bytes.
If len
is negative, val
must be nul-terminated and len
is considered to request the entire string length.
If pos
is -1, bytes are inserted at the end of the string.
(define-values (%return) (string:insert-unichar self pos wc))
Converts a Unicode character into UTF-8, and insert it into the string at the given position.
(define-values (%return) (string:overwrite self pos val))
Overwrites part of a string, lengthening it if necessary.
(define-values (%return) (string:overwrite-len self pos val len))
Overwrites part of a string, lengthening it if necessary. This function will work with embedded nuls.
(define-values (%return) (string:prepend self val))
Adds a string on to the start of a GString, expanding it if necessary.
(define-values (%return) (string:prepend-c self c))
Adds a byte onto the start of a GString, expanding it if necessary.
(define-values (%return) (string:prepend-len self val len))
Prepends len
bytes of val
to string
.
If len
is positive, val
may contain embedded nuls and need
not be nul-terminated. It is the caller's responsibility to
ensure that val
has at least len
addressable bytes.
If len
is negative, val
must be nul-terminated and len
is considered to request the entire string length. This
makes g_string_prepend_len()
equivalent to g_string_prepend()
.
(define-values (%return) (string:prepend-unichar self wc))
Converts a Unicode character into UTF-8, and prepends it to the string.
(define-values (%return) (string:set-size self len))
Sets the length of a GString. If the length is less than the current length, the string will be truncated. If the length is greater than the current length, the contents of the newly added area are undefined. (However, as always, string->str[string->len] will be a nul byte.)