Py.StringInterface for Python values of type String, Bytes and Unicode.
val check : Object.t -> boolcheck o returns o if o is a Python string (either Bytes or Unicode with Python 3).
val check_bytes : Object.t -> boolcheck_bytes o returns o if o is a Python bytes string.
val check_unicode : Object.t -> boolcheck_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
val decode_UTF8 : ?errors:string -> ?size:int -> string -> Object.tWrapper 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.
val length : Object.t -> intlength 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.
val of_string : string -> Object.tof_string s returns the Python string with the value s. s should be a valid UTF-8 string.
val of_bytes : Stdcompat.bytes -> Object.tSame as of_string but with an argument of type bytes.
val to_string : Object.t -> stringto_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.
val to_bytes : Object.t -> Stdcompat.bytesSame as to_string but with an a result of type bytes.
val of_unicode : ?size:int -> int array -> Object.tof_unicode codepoints returns the Python Unicode string with the codepoints codepoints.
val to_unicode : Object.t -> int arrayto_unicode s returns the codepoints of the Python Unicode string s.