| Safe Haskell | None |
|---|
CPython.Types.Unicode
- data Unicode
- type Encoding = Text
- data ErrorHandling
- unicodeType :: Type
- toUnicode :: Text -> IO Unicode
- fromUnicode :: Unicode -> IO Text
- length :: Unicode -> IO Integer
- fromEncodedObject :: Object obj => obj -> Encoding -> ErrorHandling -> IO Unicode
- fromObject :: Object obj => obj -> IO Unicode
- encode :: Unicode -> Encoding -> ErrorHandling -> IO Bytes
- decode :: Bytes -> Encoding -> ErrorHandling -> IO Unicode
- append :: Unicode -> Unicode -> IO Unicode
- split :: Unicode -> Maybe Unicode -> Maybe Integer -> IO List
- splitLines :: Unicode -> Bool -> IO List
- translate :: Object table => Unicode -> table -> ErrorHandling -> IO Unicode
- join :: Sequence seq => Unicode -> seq -> IO Unicode
- data MatchDirection
- tailMatch :: Unicode -> Unicode -> Integer -> Integer -> MatchDirection -> IO Bool
- data FindDirection
- find :: Unicode -> Unicode -> Integer -> Integer -> FindDirection -> IO (Maybe Integer)
- count :: Unicode -> Unicode -> Integer -> Integer -> IO Integer
- replace :: Unicode -> Unicode -> Unicode -> Maybe Integer -> IO Unicode
- format :: Unicode -> Tuple -> IO Unicode
- contains :: Object element => Unicode -> element -> IO Bool
Unicode objects
data ErrorHandling Source
Instances
fromUnicode :: Unicode -> IO TextSource
fromEncodedObject :: Object obj => obj -> Encoding -> ErrorHandling -> IO UnicodeSource
fromObject :: Object obj => obj -> IO UnicodeSource
Shortcut for fromEncodedObject "utf-8" Strict
Methods and slot functions
translate :: Object table => Unicode -> table -> ErrorHandling -> IO UnicodeSource
Translate a string by applying a character mapping table to it.
The mapping table must map Unicode ordinal integers to Unicode ordinal
integers or None (causing deletion of the character).
Mapping tables need only provide the __getitem__() interface;
dictionaries and sequences work well. Unmapped character ordinals (ones
which cause a LookupError) are left untouched and are copied as-is.
The error mode has the usual meaning for codecs.
join :: Sequence seq => Unicode -> seq -> IO UnicodeSource
Join a sequence of strings using the given separator.
data FindDirection Source
Instances
Arguments
| :: Unicode | String |
| -> Unicode | Substring |
| -> Integer | Start |
| -> Integer | End |
| -> FindDirection | |
| -> IO (Maybe Integer) |
Return the first position of the substring in string*[*start:end]
using the given direction. The return value is the index of the first
match; a value of Nothing indicates that no match was found.
Return the number of non-overlapping occurrences of the substring in
string[start:end].
Arguments
| :: Unicode | String |
| -> Unicode | Substring |
| -> Unicode | Replacement |
| -> Maybe Integer | Maximum count |
| -> IO Unicode |
Replace occurrences of the substring with a given replacement. If the
maximum count is Nothing, replace all occurences.