Package org.python.core
Class PyString
java.lang.Object
org.python.core.PyObject
org.python.core.PySequence
org.python.core.PyBaseString
org.python.core.PyString
- All Implemented Interfaces:
Serializable
,ClassDictInit
- Direct Known Subclasses:
PyStringDerived
,PyUnicode
,SyspathArchive
A builtin python string.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.python.core.PyObject
PyObject.ConversionException
-
Field Summary
FieldsFields inherited from class org.python.core.PyBaseString
exposed_base
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionEquivalent to the standard Python __add__ methodint
Equivalent to the standard Python __cmp__ method.Equivalent to the standard Python __complex__ method.boolean
Equivalent to the standard Python __contains__ method.Equivalent to the standard Python __eq__ method.Equivalent to the standard Python __float__ method.Equivalent to the standard Python __ge__ method.Equivalent to the standard Python __gt__ method.__int__()
Equivalent to the standard Python __int__ method.Equivalent to the standard Python __invert__ method.Equivalent to the standard Python __le__ method.int
__len__()
Equivalent to the standard Python __len__ method.__long__()
Equivalent to the standard Python __long__ method.Equivalent to the standard Python __lt__ method.Equivalent to the standard Python __mod__ methodEquivalent to the standard Python __ne__ method.__neg__()
Equivalent to the standard Python __neg__ method.__pos__()
Equivalent to the standard Python __pos__ method.Used for pickling.__repr__()
Equivalent to the standard Python __repr__ method.__str__()
Equivalent to the standard Python __str__ method.__tojava__
(Class c) Equivalent to the Jython __tojava__ method.asName
(int index) asString
(int index) double
atof()
int
atoi()
int
atoi
(int base) atol()
atol
(int base) center
(int width) static void
classDictInit
(PyObject dict) Internal use only.int
int
int
createInstance
(String str) decode()
static String
decode_UnicodeEscape
(String str, int start, int end, String errors, boolean unicode) encode()
static String
encode_UnicodeEscape
(String str, boolean use_quotes) static String
encode_UnicodeEscape
(String str, boolean use_quotes, boolean unicodeDesignatorPresent) boolean
boolean
boolean
boolean
Should almost never be overridden.expandtabs
(int tabsize) int
int
int
static String
from_bytes
(byte[] buf) static String
from_bytes
(byte[] buf, int off, int len) int
hashCode()
int
int
int
boolean
isalnum()
boolean
isalpha()
boolean
boolean
isdigit()
boolean
islower()
boolean
boolean
isspace()
boolean
istitle()
boolean
boolean
isupper()
ljust
(int width) lower()
lstrip()
int
int
int
int
int
int
rjust
(int width) rstrip()
safeRepr()
split()
splitlines
(boolean keepends) boolean
startswith
(String prefix) boolean
startswith
(String prefix, int offset) boolean
startswith
(String prefix, int start, int end) str___mod__
(PyObject other) strip()
swapcase()
title()
static byte[]
byte[]
toBytes()
toString()
static void
typeSetup
(PyObject dict, PyType.Newstyle marker) upper()
zfill
(int width) Methods inherited from class org.python.core.PySequence
__delitem__, __delslice__, __finditem__, __finditem__, __getitem__, __getslice__, __iter__, __nonzero__, __setitem__, __setitem__, __setslice__, isMappingType, isNumberType
Methods inherited from class org.python.core.PyObject
__abs__, __and__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __call__, __coerce__, __coerce_ex__, __delattr__, __delattr__, __delete__, __delitem__, __delslice__, __dir__, __div__, __divmod__, __findattr__, __findattr__, __finditem__, __floordiv__, __get__, __getattr__, __getattr__, __getitem__, __getslice__, __hash__, __hex__, __iadd__, __iand__, __idiv__, __idivmod__, __ifloordiv__, __ilshift__, __imod__, __imul__, __ior__, __ipow__, __irshift__, __isub__, __iternext__, __itruediv__, __ixor__, __lshift__, __mul__, __not__, __oct__, __or__, __pow__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __set__, __setattr__, __setattr__, __setitem__, __setslice__, __sub__, __truediv__, __xor__, _add, _and, _callextra, _cmp, _div, _divmod, _doget, _doget, _doset, _eq, _floordiv, _ge, _gt, _in, _is, _isnot, _jcall, _jcallexc, _jthrow, _le, _lshift, _lt, _mod, _mul, _ne, _notin, _or, _pow, _rshift, _sub, _truediv, _xor, asInt, asLong, asStringOrNull, delDict, delType, dispatch__init__, fastGetClass, fastGetDict, getDict, getDoc, getType, implementsDescrDelete, implementsDescrSet, invoke, invoke, invoke, invoke, invoke, isCallable, isDataDescr, isSequenceType, noAttributeError, readonlyAttributeError, setDict, setType
-
Field Details
-
exposed_name
- See Also:
-
-
Constructor Details
-
PyString
public PyString() -
PyString
-
PyString
-
PyString
public PyString(char c)
-
-
Method Details
-
typeSetup
-
classDictInit
Internal use only. Do not call this method explicit.- Throws:
PyIgnoreMethodTag
-
safeRepr
- Overrides:
safeRepr
in classPyObject
- Throws:
PyIgnoreMethodTag
-
__str__
Description copied from class:PyObject
Equivalent to the standard Python __str__ method. This method should not typically need to be overridden. The easiest way to configure the string representation of aPyObject
is to override the standard JavatoString
method. -
__unicode__
- Overrides:
__unicode__
in classPyObject
-
__len__
public int __len__()Description copied from class:PyObject
Equivalent to the standard Python __len__ method. Part of the mapping discipline. -
toString
-
internedString
-
__repr__
Description copied from class:PyObject
Equivalent to the standard Python __repr__ method. This method should not typically need to be overrriden. The easiest way to configure the string representation of aPyObject
is to override the standard JavatoString
method. -
encode_UnicodeEscape
-
encode_UnicodeEscape
-
decode_UnicodeEscape
-
equals
Description copied from class:PyObject
Should almost never be overridden. If overridden, it is the subclasses responsibility to ensure thata.equals(b) == true
iffcmp(a,b) == 0
-
__cmp__
Description copied from class:PyObject
Equivalent to the standard Python __cmp__ method. -
__eq__
Description copied from class:PyObject
Equivalent to the standard Python __eq__ method.- Overrides:
__eq__
in classPySequence
- Parameters:
other
- the object to compare this with.- Returns:
- the result of the comparison.
-
__ne__
Description copied from class:PyObject
Equivalent to the standard Python __ne__ method.- Overrides:
__ne__
in classPySequence
- Parameters:
other
- the object to compare this with.- Returns:
- the result of the comparison.
-
__lt__
Description copied from class:PyObject
Equivalent to the standard Python __lt__ method.- Overrides:
__lt__
in classPySequence
- Parameters:
other
- the object to compare this with.- Returns:
- the result of the comparison.
-
__le__
Description copied from class:PyObject
Equivalent to the standard Python __le__ method.- Overrides:
__le__
in classPySequence
- Parameters:
other
- the object to compare this with.- Returns:
- the result of the comparison.
-
__gt__
Description copied from class:PyObject
Equivalent to the standard Python __gt__ method.- Overrides:
__gt__
in classPySequence
- Parameters:
other
- the object to compare this with.- Returns:
- the result of the comparison.
-
__ge__
Description copied from class:PyObject
Equivalent to the standard Python __ge__ method.- Overrides:
__ge__
in classPySequence
- Parameters:
other
- the object to compare this with.- Returns:
- the result of the comparison.
-
hashCode
public int hashCode() -
toBytes
public byte[] toBytes()- Returns:
- a byte array with one byte for each char in this object's underlying String. Each byte contains the low-order bits of its corresponding char.
-
to_bytes
- Returns:
- a byte array with one byte for each char in s. Each byte contains the low-order bits of its corresponding char.
-
from_bytes
- Returns:
- A String with chars corresponding to the bytes in buf
-
from_bytes
- Returns:
- A String of len buff with chars corresponding to buf from off to off + len
-
__tojava__
Description copied from class:PyObject
Equivalent to the Jython __tojava__ method. Tries to coerce this object to an instance of the requested Java class. Returns the special objectPy.NoConversion
if thisPyObject
can not be converted to the desired Java class.- Overrides:
__tojava__
in classPySequence
- Parameters:
c
- the Class to convert thisPyObject
to.
-
createInstance
-
__contains__
Description copied from class:PyObject
Equivalent to the standard Python __contains__ method.- Overrides:
__contains__
in classPyObject
- Parameters:
o
- the element to search for in this container.- Returns:
- the result of the search.
-
__add__
Description copied from class:PyObject
Equivalent to the standard Python __add__ method -
__reduce__
Used for pickling.- Overrides:
__reduce__
in classPyObject
- Returns:
- a tuple of (class, tuple)
-
__getnewargs__
- Overrides:
__getnewargs__
in classPyObject
-
__mod__
Description copied from class:PyObject
Equivalent to the standard Python __mod__ method -
str___mod__
-
__int__
Description copied from class:PyObject
Equivalent to the standard Python __int__ method. Should only be overridden by numeric objects that can be reasonably coerced into an integer. -
__long__
Description copied from class:PyObject
Equivalent to the standard Python __long__ method. Should only be overridden by numeric objects that can be reasonably coerced into a python long. -
__float__
Description copied from class:PyObject
Equivalent to the standard Python __float__ method. Should only be overridden by numeric objects that can be reasonably coerced into a python float. -
__pos__
Description copied from class:PyObject
Equivalent to the standard Python __pos__ method. -
__neg__
Description copied from class:PyObject
Equivalent to the standard Python __neg__ method. -
__invert__
Description copied from class:PyObject
Equivalent to the standard Python __invert__ method.- Overrides:
__invert__
in classPyObject
- Returns:
- ~this.
-
__complex__
Description copied from class:PyObject
Equivalent to the standard Python __complex__ method. Should only be overridden by numeric objects that can be reasonably coerced into a python complex number.- Overrides:
__complex__
in classPyObject
- Returns:
- a complex number corresponding to the value of this object.
-
lower
-
upper
-
title
-
swapcase
-
strip
-
strip
-
lstrip
-
lstrip
-
rstrip
-
rstrip
-
split
-
split
-
split
-
splitlines
-
splitlines
-
index
-
index
-
index
-
rindex
-
rindex
-
rindex
-
count
-
count
-
count
-
find
-
find
-
find
-
rfind
-
rfind
-
rfind
-
atof
public double atof() -
atoi
public int atoi() -
atoi
public int atoi(int base) -
atol
-
atol
-
ljust
-
rjust
-
center
-
zfill
-
expandtabs
-
expandtabs
-
capitalize
-
join
-
startswith
-
startswith
-
startswith
-
endswith
-
endswith
-
endswith
-
translate
-
translate
-
translate
-
islower
public boolean islower() -
isupper
public boolean isupper() -
isalpha
public boolean isalpha() -
isalnum
public boolean isalnum() -
isdecimal
public boolean isdecimal() -
isdigit
public boolean isdigit() -
isnumeric
public boolean isnumeric() -
istitle
public boolean istitle() -
isspace
public boolean isspace() -
isunicode
public boolean isunicode() -
encode
-
encode
-
encode
-
decode
-
decode
-
decode
-
asString
- Overrides:
asString
in classPyObject
- Throws:
PyObject.ConversionException
-
asName
- Overrides:
asName
in classPyObject
- Throws:
PyObject.ConversionException
-