CString

class fairseq2.data.CString[source]
class fairseq2.data.CString(s: str)

Bases: object

Represents an immutable UTF-8 string that supports zero-copy marshalling between Python and native code.

Parameters:

s (str | None) – The Python string to copy.

lstrip()[source]

Return a copy of this string with no whitespace at the beginning.

Return type:

CString

rstrip()[source]

Return a copy of this string with no whitespace at the end.

Return type:

CString

split(sep=None)[source]

Return a list of the words in string using sep as the delimiter string.

Return type:

List[CString]

strip()[source]

Return a copy of this string with no whitespace at the beginning and end.

Return type:

CString