| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.GLib.Structs.String
Contents
- Exported types
- Methods
- append
- appendC
- appendLen
- appendUnichar
- appendUriEscaped
- asciiDown
- asciiUp
- assign
- copy
- down
- equal
- erase
- free
- freeAndSteal
- freeDeep
- freeToBytes
- hash
- insert
- insertC
- insertLen
- insertUnichar
- new
- newLen
- newTake
- overwrite
- overwriteLen
- prepend
- prependC
- prependLen
- prependUnichar
- replace
- setSize
- sizedNew
- truncate
- up
- Properties
Description
A GString is an object that handles the memory management of a C string.
The emphasis of GString is on text, typically UTF-8. Crucially, the "str" member
of a GString is guaranteed to have a trailing nul character, and it is therefore
always safe to call functions such as strchr() or strdup() on it.
However, a GString can also hold arbitrary binary data, because it has a "len" member,
which includes any possible embedded nul characters in the data. Conceptually then,
GString is like a GByteArray with the addition of many convenience methods for
text, and a guaranteed nul terminator.
Synopsis
- newtype String = String (ManagedPtr String)
- newZeroString :: MonadIO m => m String
- type family ResolveStringMethod (t :: Symbol) o where ...
- data StringAppendMethodInfo
- stringAppend :: (HasCallStack, MonadIO m) => String -> Text -> m String
- data StringAppendCMethodInfo
- stringAppendC :: (HasCallStack, MonadIO m) => String -> Int8 -> m String
- data StringAppendLenMethodInfo
- stringAppendLen :: (HasCallStack, MonadIO m) => String -> Text -> Int64 -> m String
- data StringAppendUnicharMethodInfo
- stringAppendUnichar :: (HasCallStack, MonadIO m) => String -> Char -> m String
- data StringAppendUriEscapedMethodInfo
- stringAppendUriEscaped :: (HasCallStack, MonadIO m) => String -> Text -> Text -> Bool -> m String
- data StringAsciiDownMethodInfo
- stringAsciiDown :: (HasCallStack, MonadIO m) => String -> m String
- data StringAsciiUpMethodInfo
- stringAsciiUp :: (HasCallStack, MonadIO m) => String -> m String
- data StringAssignMethodInfo
- stringAssign :: (HasCallStack, MonadIO m) => String -> Text -> m String
- data StringCopyMethodInfo
- stringCopy :: (HasCallStack, MonadIO m) => String -> m String
- data StringDownMethodInfo
- stringDown :: (HasCallStack, MonadIO m) => String -> m String
- data StringEqualMethodInfo
- stringEqual :: (HasCallStack, MonadIO m) => String -> String -> m Bool
- data StringEraseMethodInfo
- stringErase :: (HasCallStack, MonadIO m) => String -> Int64 -> Int64 -> m String
- data StringFreeMethodInfo
- stringFree :: (HasCallStack, MonadIO m) => String -> Bool -> m (Maybe Text)
- data StringFreeAndStealMethodInfo
- stringFreeAndSteal :: (HasCallStack, MonadIO m) => String -> m Text
- data StringFreeDeepMethodInfo
- stringFreeDeep :: (HasCallStack, MonadIO m) => String -> m ()
- data StringFreeToBytesMethodInfo
- stringFreeToBytes :: (HasCallStack, MonadIO m) => String -> m Bytes
- data StringHashMethodInfo
- stringHash :: (HasCallStack, MonadIO m) => String -> m Word32
- data StringInsertMethodInfo
- stringInsert :: (HasCallStack, MonadIO m) => String -> Int64 -> Text -> m String
- data StringInsertCMethodInfo
- stringInsertC :: (HasCallStack, MonadIO m) => String -> Int64 -> Int8 -> m String
- data StringInsertLenMethodInfo
- stringInsertLen :: (HasCallStack, MonadIO m) => String -> Int64 -> Text -> Int64 -> m String
- data StringInsertUnicharMethodInfo
- stringInsertUnichar :: (HasCallStack, MonadIO m) => String -> Int64 -> Char -> m String
- stringNew :: (HasCallStack, MonadIO m) => Maybe Text -> m String
- stringNewLen :: (HasCallStack, MonadIO m) => Text -> Int64 -> m String
- stringNewTake :: (HasCallStack, MonadIO m) => Maybe Text -> m String
- data StringOverwriteMethodInfo
- stringOverwrite :: (HasCallStack, MonadIO m) => String -> CSize -> Text -> m String
- data StringOverwriteLenMethodInfo
- stringOverwriteLen :: (HasCallStack, MonadIO m) => String -> CSize -> Text -> Int64 -> m String
- data StringPrependMethodInfo
- stringPrepend :: (HasCallStack, MonadIO m) => String -> Text -> m String
- data StringPrependCMethodInfo
- stringPrependC :: (HasCallStack, MonadIO m) => String -> Int8 -> m String
- data StringPrependLenMethodInfo
- stringPrependLen :: (HasCallStack, MonadIO m) => String -> Text -> Int64 -> m String
- data StringPrependUnicharMethodInfo
- stringPrependUnichar :: (HasCallStack, MonadIO m) => String -> Char -> m String
- data StringReplaceMethodInfo
- stringReplace :: (HasCallStack, MonadIO m) => String -> Text -> Text -> Word32 -> m Word32
- data StringSetSizeMethodInfo
- stringSetSize :: (HasCallStack, MonadIO m) => String -> CSize -> m String
- stringSizedNew :: (HasCallStack, MonadIO m) => CSize -> m String
- data StringTruncateMethodInfo
- stringTruncate :: (HasCallStack, MonadIO m) => String -> CSize -> m String
- data StringUpMethodInfo
- stringUp :: (HasCallStack, MonadIO m) => String -> m String
- getStringAllocatedLen :: MonadIO m => String -> m CSize
- setStringAllocatedLen :: MonadIO m => String -> CSize -> m ()
- string_allocatedLen :: AttrLabelProxy "allocatedLen"
- getStringLen :: MonadIO m => String -> m CSize
- setStringLen :: MonadIO m => String -> CSize -> m ()
- string_len :: AttrLabelProxy "len"
- clearStringStr :: MonadIO m => String -> m ()
- getStringStr :: MonadIO m => String -> m (Maybe Text)
- setStringStr :: MonadIO m => String -> CString -> m ()
- string_str :: AttrLabelProxy "str"
Exported types
Memory-managed wrapper type.
Constructors
| String (ManagedPtr String) |
Instances
Methods
Click to display all available methods, including inherited ones
Methods
append, appendC, appendLen, appendUnichar, appendUriEscaped, asciiDown, asciiUp, assign, copy, down, equal, erase, free, freeAndSteal, freeDeep, freeToBytes, hash, insert, insertC, insertLen, insertUnichar, overwrite, overwriteLen, prepend, prependC, prependLen, prependUnichar, replace, truncate, up.
Getters
None.
Setters
type family ResolveStringMethod (t :: Symbol) o where ... Source #
Equations
append
data StringAppendMethodInfo Source #
Instances
| (signature ~ (Text -> m String), MonadIO m) => OverloadedMethod StringAppendMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAppendMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> m String | Returns: |
Adds a string onto the end of a String, expanding
it if necessary.
appendC
data StringAppendCMethodInfo Source #
Instances
| (signature ~ (Int8 -> m String), MonadIO m) => OverloadedMethod StringAppendCMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAppendCMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Int8 |
|
| -> m String | Returns: |
Adds a byte onto the end of a String, expanding
it if necessary.
appendLen
data StringAppendLenMethodInfo Source #
Instances
| (signature ~ (Text -> Int64 -> m String), MonadIO m) => OverloadedMethod StringAppendLenMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAppendLenMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> Int64 |
|
| -> m String | Returns: |
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 stringAppendLen equivalent to stringAppend.
appendUnichar
data StringAppendUnicharMethodInfo Source #
Instances
| (signature ~ (Char -> m String), MonadIO m) => OverloadedMethod StringAppendUnicharMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAppendUnicharMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Char |
|
| -> m String | Returns: |
Converts a Unicode character into UTF-8, and appends it to the string.
appendUriEscaped
data StringAppendUriEscapedMethodInfo Source #
Instances
| (signature ~ (Text -> Text -> Bool -> m String), MonadIO m) => OverloadedMethod StringAppendUriEscapedMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAppendUriEscapedMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
stringAppendUriEscaped Source #
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> Text |
|
| -> Bool |
|
| -> m String | Returns: |
Appends unescaped to string, escaping any characters that
are reserved in URIs using URI-style escape sequences.
Since: 2.16
asciiDown
data StringAsciiDownMethodInfo Source #
Instances
| (signature ~ m String, MonadIO m) => OverloadedMethod StringAsciiDownMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAsciiDownMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m String | Returns: passed-in |
Converts all uppercase ASCII letters to lowercase ASCII letters.
asciiUp
data StringAsciiUpMethodInfo Source #
Instances
| (signature ~ m String, MonadIO m) => OverloadedMethod StringAsciiUpMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAsciiUpMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m String | Returns: passed-in |
Converts all lowercase ASCII letters to uppercase ASCII letters.
assign
data StringAssignMethodInfo Source #
Instances
| (signature ~ (Text -> m String), MonadIO m) => OverloadedMethod StringAssignMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringAssignMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> m String | Returns: |
Copies the bytes from a string into a String,
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.
copy
data StringCopyMethodInfo Source #
Instances
| (signature ~ m String, MonadIO m) => OverloadedMethod StringCopyMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringCopyMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m String | Returns: a copy of |
down
data StringDownMethodInfo Source #
Instances
| (signature ~ m String, MonadIO m) => OverloadedMethod StringDownMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringDownMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Deprecated: (Since version 2.2)This function uses the locale-specifictolower() function, which is almost never the right thing.Use stringAsciiDown or utf8Strdown instead.
Converts a String to lowercase.
equal
data StringEqualMethodInfo Source #
Instances
| (signature ~ (String -> m Bool), MonadIO m) => OverloadedMethod StringEqualMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringEqualMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
erase
data StringEraseMethodInfo Source #
Instances
| (signature ~ (Int64 -> Int64 -> m String), MonadIO m) => OverloadedMethod StringEraseMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringEraseMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
free
data StringFreeMethodInfo Source #
Instances
| (signature ~ (Bool -> m (Maybe Text)), MonadIO m) => OverloadedMethod StringFreeMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringFreeMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Bool |
|
| -> m (Maybe Text) | Returns: the character data of |
Frees the memory allocated for the String.
If freeSegment 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 free.
Instead of passing False to this function, consider using
stringFreeAndSteal.
Similarly, instead of passing TRUE to this function,
stringFreeDeep can be used. In particular, it can be used
with GLib.clear_pointer.
freeAndSteal
data StringFreeAndStealMethodInfo Source #
Instances
| (signature ~ m Text, MonadIO m) => OverloadedMethod StringFreeAndStealMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringFreeAndStealMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m Text | Returns: the character data of |
freeDeep
data StringFreeDeepMethodInfo Source #
Instances
| (signature ~ m (), MonadIO m) => OverloadedMethod StringFreeDeepMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringFreeDeepMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m () |
Frees the memory allocated for the String together with its
character data.
This is equivalent to calling g_string_free (string, TRUE), but it can
be used with GLib.clear_pointer:
c code
g_clear_pointer (&my_string, g_string_free_deep);
Since: 2.90
freeToBytes
data StringFreeToBytesMethodInfo Source #
Instances
| (signature ~ m Bytes, MonadIO m) => OverloadedMethod StringFreeToBytesMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringFreeToBytesMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m Bytes | Returns: A newly allocated |
Transfers ownership of the contents of string to a newly allocated
Bytes. The String structure itself is deallocated, and it is
therefore invalid to use string after invoking this function.
Note that while String ensures that its buffer always has a
trailing nul character (not reflected in its "len"), the returned
Bytes does not include this extra nul; i.e. it has length exactly
equal to the "len" member.
Since: 2.34
hash
data StringHashMethodInfo Source #
Instances
| (signature ~ m Word32, MonadIO m) => OverloadedMethod StringHashMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringHashMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m Word32 | Returns: hash code for |
Creates a hash code for str; for use with HashTable.
insert
data StringInsertMethodInfo Source #
Instances
| (signature ~ (Int64 -> Text -> m String), MonadIO m) => OverloadedMethod StringInsertMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringInsertMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Int64 |
|
| -> Text |
|
| -> m String | Returns: |
Inserts a copy of a string into a String,
expanding it if necessary.
insertC
data StringInsertCMethodInfo Source #
Instances
| (signature ~ (Int64 -> Int8 -> m String), MonadIO m) => OverloadedMethod StringInsertCMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringInsertCMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Int64 |
|
| -> Int8 |
|
| -> m String | Returns: |
Inserts a byte into a String, expanding it if necessary.
insertLen
data StringInsertLenMethodInfo Source #
Instances
| (signature ~ (Int64 -> Text -> Int64 -> m String), MonadIO m) => OverloadedMethod StringInsertLenMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringInsertLenMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Int64 |
|
| -> Text |
|
| -> Int64 |
|
| -> m String | Returns: |
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.
insertUnichar
data StringInsertUnicharMethodInfo Source #
Instances
| (signature ~ (Int64 -> Char -> m String), MonadIO m) => OverloadedMethod StringInsertUnicharMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringInsertUnicharMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Int64 |
|
| -> Char |
|
| -> m String | Returns: |
Converts a Unicode character into UTF-8, and insert it into the string at the given position.
new
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Maybe Text |
|
| -> m String | Returns: the new |
Creates a new String, initialized with the given string.
newLen
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Text |
|
| -> Int64 |
|
| -> m String | Returns: a new |
Creates a new String with len bytes of the init buffer.
Because a length is provided, init need not be nul-terminated,
and can contain embedded nul bytes.
Since this function does not stop at nul bytes, it is the caller's
responsibility to ensure that init has at least len addressable
bytes.
newTake
overwrite
data StringOverwriteMethodInfo Source #
Instances
| (signature ~ (CSize -> Text -> m String), MonadIO m) => OverloadedMethod StringOverwriteMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringOverwriteMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> CSize |
|
| -> Text |
|
| -> m String | Returns: |
Overwrites part of a string, lengthening it if necessary.
Since: 2.14
overwriteLen
data StringOverwriteLenMethodInfo Source #
Instances
| (signature ~ (CSize -> Text -> Int64 -> m String), MonadIO m) => OverloadedMethod StringOverwriteLenMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringOverwriteLenMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> CSize |
|
| -> Text |
|
| -> Int64 |
|
| -> m String | Returns: |
Overwrites part of a string, lengthening it if necessary. This function will work with embedded nuls.
Since: 2.14
prepend
data StringPrependMethodInfo Source #
Instances
| (signature ~ (Text -> m String), MonadIO m) => OverloadedMethod StringPrependMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringPrependMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> m String | Returns: |
Adds a string on to the start of a String,
expanding it if necessary.
prependC
data StringPrependCMethodInfo Source #
Instances
| (signature ~ (Int8 -> m String), MonadIO m) => OverloadedMethod StringPrependCMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringPrependCMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Int8 |
|
| -> m String | Returns: |
Adds a byte onto the start of a String,
expanding it if necessary.
prependLen
data StringPrependLenMethodInfo Source #
Instances
| (signature ~ (Text -> Int64 -> m String), MonadIO m) => OverloadedMethod StringPrependLenMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringPrependLenMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> Int64 |
|
| -> m String | Returns: |
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 stringPrependLen equivalent to stringPrepend.
prependUnichar
data StringPrependUnicharMethodInfo Source #
Instances
| (signature ~ (Char -> m String), MonadIO m) => OverloadedMethod StringPrependUnicharMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringPrependUnicharMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Char |
|
| -> m String | Returns: |
Converts a Unicode character into UTF-8, and prepends it to the string.
replace
data StringReplaceMethodInfo Source #
Instances
| (signature ~ (Text -> Text -> Word32 -> m Word32), MonadIO m) => OverloadedMethod StringReplaceMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringReplaceMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> Text |
|
| -> Text |
|
| -> Word32 |
|
| -> m Word32 | Returns: the number of find and replace operations performed,
up to |
Replaces the string find with the string replace in a String up to
limit times. If the number of instances of find in the String is
less than limit, all instances are replaced. If limit is 0,
all instances of find are replaced.
If find is the empty string, since versions 2.69.1 and 2.68.4 the
replacement will be inserted no more than once per possible position
(beginning of string, end of string and between characters). This did
not work correctly in earlier versions.
If limit is zero and more than G_MAXUINT instances of find are in
the input string, they will all be replaced, but the return value will
be capped at G_MAXUINT.
Since: 2.68
setSize
data StringSetSizeMethodInfo Source #
Instances
| (signature ~ (CSize -> m String), MonadIO m) => OverloadedMethod StringSetSizeMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringSetSizeMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> CSize |
|
| -> m String | Returns: |
Sets the length of a String. 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.)
sizedNew
Arguments
| :: (HasCallStack, MonadIO m) | |
| => CSize |
|
| -> m String | Returns: the new |
Creates a new String, with enough space for dflSize
bytes. This is useful if you are going to add a lot of
text to the string and don't want it to be reallocated
too often.
truncate
data StringTruncateMethodInfo Source #
Instances
| (signature ~ (CSize -> m String), MonadIO m) => OverloadedMethod StringTruncateMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringTruncateMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> CSize |
|
| -> m String | Returns: |
Cuts off the end of the GString, leaving the first len bytes.
up
data StringUpMethodInfo Source #
Instances
| (signature ~ m String, MonadIO m) => OverloadedMethod StringUpMethodInfo String signature Source # | |
Defined in GI.GLib.Structs.String Methods overloadedMethod :: String -> signature # | |
| OverloadedMethodInfo StringUpMethodInfo String Source # | |
Defined in GI.GLib.Structs.String Methods | |
Arguments
| :: (HasCallStack, MonadIO m) | |
| => String |
|
| -> m String | Returns: |
Deprecated: (Since version 2.2)This function uses the locale-specifictoupper() function, which is almost never the right thing.Use stringAsciiUp or utf8Strup instead.
Converts a String to uppercase.
Properties
allocatedLen
the number of bytes that can be stored in the
string before it needs to be reallocated. May be larger than len.
getStringAllocatedLen :: MonadIO m => String -> m CSize Source #
Get the value of the “allocated_len” field.
When overloading is enabled, this is equivalent to
get string #allocatedLen
setStringAllocatedLen :: MonadIO m => String -> CSize -> m () Source #
Set the value of the “allocated_len” field.
When overloading is enabled, this is equivalent to
setstring [ #allocatedLen:=value ]
string_allocatedLen :: AttrLabelProxy "allocatedLen" Source #
len
contains the length of the string, not including the terminating nul byte.
getStringLen :: MonadIO m => String -> m CSize Source #
Get the value of the “len” field.
When overloading is enabled, this is equivalent to
get string #len
setStringLen :: MonadIO m => String -> CSize -> m () Source #
Set the value of the “len” field.
When overloading is enabled, this is equivalent to
setstring [ #len:=value ]
string_len :: AttrLabelProxy "len" Source #
str
points to the character data. It may move as text is added.
The str field is null-terminated and so
can be used as an ordinary C string.
clearStringStr :: MonadIO m => String -> m () Source #
Set the value of the “str” field to Nothing.
When overloading is enabled, this is equivalent to
clear #str
getStringStr :: MonadIO m => String -> m (Maybe Text) Source #
Get the value of the “str” field.
When overloading is enabled, this is equivalent to
get string #str
setStringStr :: MonadIO m => String -> CString -> m () Source #
Set the value of the “str” field.
When overloading is enabled, this is equivalent to
setstring [ #str:=value ]
string_str :: AttrLabelProxy "str" Source #