NAME ^

classes/pystring.pmc - Python String

DESCRIPTION ^

PyString extends PyObject to provide Python string behaviour.

Methods ^

PMC* "__getitem__"(PMC *self, PMC *index)

Returns the PMC value of the element at index key.

PMC* "__setitem__"(PMC *self, PMC *index, PMC *value)

Sets the PMC at element index to *value.

PMC* "__new__"(PMC *class, PMC *source)

Create a new string

void add(PMC *value, PMC *dest)

Concatenates *value to the string and returns the result in *dest.

INTVAL cmp(PMC *value)

Returns the result of comparing the string with *value.

void concatenate(PMC *value, PMC *dest)

Concatenates the string and the stringified form of *value and return the result in *dest, morphing it to a PyString if required.

INTVAL elements ()

Return length of the string.

INTVAL hash()

Returns a unique hash for this value

INTVAL get_bool()

Returns the pyboolean value of the string.

PMC *get_class()

Return the class of this object.

PMC *get_iter (PMC *key)

Return a new iterator for this string.

INTVAL get_integer()

Returns the integer representation of the string.

FLOATVAL get_number()

Returns the floating-point representation of the string.

PMC *get_pmc_keyed(INTVAL key)

Extracts a given character from the string.

PMC *get_pmc_keyed_int(INTVAL key)

Extracts a given character from the string.

STRING *get_repr()

Returns pythons string repr (w/o any escaping, just single quotes around)

STRING *get_string()

INTVAL is_equal(PMC *value)

The == operation.

PMC* "isalpha"(PMC *self)

Return True if all characters in S are alphabetic and there is at least one character in S, False otherwise.

PMC* "isalnum"()

Return True if all characters in S are alphabetic or numeric and there is at least one character in S, False otherwise.

PMC* "isdigit"(PMC *self)

Return True if all characters in S are numeric and there is at least one character in S, False otherwise.

PMC* "isspace"(PMC *self)

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

PMC* "join"(PMC *self, PMC *sequence)

Return True if all characters in S are whitespace and there is at least one character in S, False otherwise.

PMC* "lower"(PMC *self)

downcase this string

PMC* "find"(PMC *haystack, PMC *needle)

void modulus(PMC *value, PMC *dest)

Interpolates a formatstring with a set of values.

void set_pmc(PMC *value)

Sets the PMC *value, calling the appropriate set_* method according to the type of *value.

void set_string_native(STRING *value)

Sets the string's value to the value of the specified Parrot string.

void set_string_same(PMC *value)

Sets the string's value to the value of the specified PyString.


parrot