Top Description Constructors Methods
org.python.core.util

public Class StringUtil

extends Object
Class Inheritance
Imports
java.io.UnsupportedEncodingException, java.nio.ByteBuffer, org.python.core.BaseBytes, .Py, .PyBuffer

String Utility methods.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static String

Returns:

a decapitalized String
decapitalize
(String
a String
string
)

Decapitalize a String if it begins with a capital letter, e.g.: decapitalize("FooBar") == "fooBar"

public static String

Returns:

a new String corresponding to the bytes in buf
fromBytes
(byte[]
an array of bytes
buf
,
int
the initial offset
off
,
int
the length
len
)

Return a new String with chars corresponding to buf from off to off + len.

public static String

Returns:

a new String corresponding to the bytes in buf
fromBytes
(byte[]
an array of bytes
buf
)

Return a new String with chars corresponding to buf.

public static String

Returns:

a new String corresponding to the bytes in buf
fromBytes
(ByteBuffer
a ByteBuffer of bytes
buf
)

Return a new String with chars corresponding to buf.

public static String

Returns:

a new String corresponding to the bytes in buf
fromBytes
(PyBuffer
a PyBuffer of bytes
buf
)

Return a new String with chars corresponding to buf, which is a byte-oriented buffer obtained through the buffer API.

public static String

Returns:

a new String corresponding to the bytes in b
fromBytes
(BaseBytes
a BaseBytes containing bytes
b
)

Return a new String with chars corresponding to b.

public static byte[]

Returns:

a byte array with one byte for each char in string
toBytes
(String
a String value
string
)

Encodes this String into a sequence of bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

StringUtilback to summary
public StringUtil()

Method Detail

decapitalizeback to summary
public static String decapitalize(String string)

Decapitalize a String if it begins with a capital letter, e.g.: decapitalize("FooBar") == "fooBar"

Parameters
string:String

a String

Returns:String

a decapitalized String

fromBytesback to summary
public static String fromBytes(byte[] buf, int off, int len)

Return a new String with chars corresponding to buf from off to off + len.

Parameters
buf:byte[]

an array of bytes

off:int

the initial offset

len:int

the length

Returns:String

a new String corresponding to the bytes in buf

Annotations
@SuppressWarnings:deprecation

fromBytesback to summary
public static String fromBytes(byte[] buf)

Return a new String with chars corresponding to buf.

Parameters
buf:byte[]

an array of bytes

Returns:String

a new String corresponding to the bytes in buf

fromBytesback to summary
public static String fromBytes(ByteBuffer buf)

Return a new String with chars corresponding to buf.

Parameters
buf:ByteBuffer

a ByteBuffer of bytes

Returns:String

a new String corresponding to the bytes in buf

fromBytesback to summary
public static String fromBytes(PyBuffer buf)

Return a new String with chars corresponding to buf, which is a byte-oriented buffer obtained through the buffer API. It depends on the implementation of PyBuffer#toString() provided by each buffer implementation.

Parameters
buf:PyBuffer

a PyBuffer of bytes

Returns:String

a new String corresponding to the bytes in buf

fromBytesback to summary
public static String fromBytes(BaseBytes b)

Return a new String with chars corresponding to b.

Parameters
b:BaseBytes

a BaseBytes containing bytes

Returns:String

a new String corresponding to the bytes in b

toBytesback to summary
public static byte[] toBytes(String string)

Encodes this String into a sequence of bytes. Each byte contains the low-order bits of its corresponding char.

Parameters
string:String

a String value

Returns:byte[]

a byte array with one byte for each char in string