Py.StringSourceInterface for Python values of type String, Bytes and Unicode.
check o returns o if o is a Python string (either Bytes or Unicode with Python 3).
check_unicode o returns o if o is a Python unicode string.
format fmt args returns the formatted Python string from the string format fmt and the arguments args. This is analogous to fmt % args. With Python 2, if fmt is a String, wrapper for PyString_Format. With Python 3 or with Python 2 if fmt is Unicode, wrapper for PyUnicode_Format.
Wrapper for PyUnicode_AsUTF8String
Wrapper for PyUnicode_DecodeUTF8. If size is omitted, the length of the string is used by default.
val decode_UTF16 :
?errors:string ->
?size:int ->
?byteorder:byteorder ->
string ->
Object.t * byteorderWrapper for PyUnicode_DecodeUTF16. If size is omitted, the length of the string is used by default.
val decode_UTF32 :
?errors:string ->
?size:int ->
?byteorder:byteorder ->
string ->
Object.t * byteorderWrapper for PyUnicode_DecodeUTF32. If size is omitted, the length of the string is used by default.
length s returns the length of the Python string s. A failure (Failure _) is raised if s is neither a Bytes value nor a Unicode value. With Python 2, if s is a String, wrapper for PyString_Size, and if s is Unicode, wrapper for PyUnicode_GetSize, With Python 3, if s is Bytes, wrapper for PyBytes_Size, and if s is Unicode, wrapper for PyUnicode_GetLength.
of_string s returns the Python string with the value s. s should be a valid UTF-8 string.
Same as of_string but with an argument of type bytes.
to_string o returns the string contained in the Python value o. A failure (Failure _) is raised if o is neither a String/Bytes value nor a Unicode value.
Same as to_string but with an a result of type bytes.
of_unicode codepoints returns the Python Unicode string with the codepoints codepoints.