Pyjo.String.Bytes - Bytes string

import Pyjo.String.Bytes

# Manipulate String.Bytes
string = Pyjo.String.Bytes.new('foo:bar:baz')
print(string.url_escape().decode('ascii'))

# Use the alternative constructor
from Pyjo.String.Bytes import b
bstring = b('foo:bar:baz').url_escape()

Pyjo.String.Bytes is a container for bytes strings that provides a more friendly API for many of the functions in Pyjo.Util.

It also inherits all methods from either str (Python 2.x) or bytes (Python 3.x).

Classes

class Pyjo.String.Bytes.Pyjo_String_Bytes

Pyjo.String.Bytes inherits all methods from either str (Python 2.x) or bytes (Python 3.x) and implements the following new ones.

decode(charset='utf-8')
string = string.decode()
string = string.decode('iso-8859-1')

Decode bytes string, defaults to utf-8, and return new Pyjo.String.Unicode object.

string.decode('UTF-16LE').unquote().trim().say()
classmethod new(value='', charset='utf-8')
string = Pyjo.String.Bytes.new('test123')

Construct a new Pyjo.String.Bytes object.

url_escape()
string = string.url_escape()
string = string.url_escape(br'^A-Za-z0-9\-._~')

Percent encode all unsafe characters in bytes string with Pyjo.Util.url_escape().

b('foo bar baz').url_escape().decode().say()
url_unescape()
string = string.url_unescape()

Decode percent encoded characters in bytes string with Pyjo.Util.url_unescape().

b('%3Chtml%3E').url_unescape().decode().xml_escape().say()
Pyjo.String.Bytes.b(value='', charset='utf-8')
string = b('test123')

Construct a new Pyjo.String.Bytes object.

Pyjo.String.Bytes.object

alias of Pyjo_String_Bytes