Skip to content

Text

Contains blocks to manipulate texts.

count(*, text)

Counts the characters in a string.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required

count_piece(*, text, piece)

Return the number of non-overlapping occurrences of substring in string.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
piece str

The piece that will be searched.

required

create(*, value)

Convert a value to text.

Parameters:

Name Type Description Default
value Any

Any value.

required

ends_with(*, text, piece)

Return True if text ends with the specified piece, False otherwise.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
piece str

The piece that will be checked.

required

get_(*, text, index)

Gets the character in specified index.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
index int

The index of the character.

required

includes(*, text, piece)

Checks if piece is in the text.

Parameters:

Name Type Description Default
text str

The text that piece will be checked in.

required
piece str

The piece that will be searched.

required

includes_all(*, text, pieces)

Checks if all of the pieces in the text.

Added in v1.1

Parameters:

Name Type Description Default
text str

The text that pieces will be checked in.

required
pieces List[str]

A list of pieces that will be searched.

required

includes_any(*, text, pieces)

Checks if one of the pieces in the text.

Added in v1.1

Parameters:

Name Type Description Default
text str

The text that pieces will be checked in.

required
pieces List[str]

A list of pieces that will be searched.

required

is_alpha(*, text)

Return True if the string is an alphabetic string, False otherwise. A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.

Added in v1.1

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required

is_empty(*, text, include_spaces=True)

Checks if string is empty.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
include_spaces bool

Set it True to include spaces too, if you want to strip the text first, set it to False.

True

is_numeric(*, text)

Return True if the string is a numeric string, False otherwise. A string is numeric if all characters in the string are numeric and there is at least one character in the string.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required

is_text(*, value)

Return True if the thing is a text, False otherwise.

Parameters:

Name Type Description Default
value Any

Any value.

required

join(*, text1, text2, join_with=' ')

Joins two texts.

Parameters:

Name Type Description Default
text1 str

A string that will be added to start.

required
text2 str

A string that will be added to end.

required
join_with str

A string that will be added between text1 and text2.

' '

join_list(*, list, seperator='')

Joins all strings in the list.

Parameters:

Name Type Description Default
seperator str

A seperator for joining strings.

''
list List[str]

A list that contains strings.

required

lowercase(*, text)

Return a copy of the string converted to lowercase.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required

replace(*, text, old, new, count=-1)

Return a copy with all occurrences of substring old replaced by new. If the optional argument count is given, only the first count occurrences are replaced.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
old str

The string that will be replaced.

required
new str

The string that old replaced with.

required
count int

If given, only the first count occurrences are replaced.

-1

split(*, text, seperator=None, maxsplit=-1)

Return a list of the words in the string, using "seperator" parameter as the delimiter string.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
seperator str

The delimiter according which to split the string. None (the default value) means split according to any whitespace, and discard empty strings from the result.

None
maxsplit int

Maximum number of splits to do. -1 (the default value) means no limit.

-1

split_chars(*, text)

Return a list of the characters in the string.

Added in v1.1

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required

split_lines(*, text, keep_ends=False)

Return a list of the lines in the string, breaking at line boundaries.

Added in v1.1

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
keep_ends bool

Include line breaks in the resulting list.

False

starts_with(*, text, piece)

Return True if text starts with the specified piece, False otherwise.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
piece str

The piece that will be checked.

required

strip(*, text, chars=None)

Return a copy of the string with leading and trailing whitespace removed. If chars is given and not None, remove characters in chars instead.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required
chars str

If given, removes these characters from the string instead of trimming.

None

titlecase(*, text)

Return a version of the string where each word is titlecased. More specifically, words start with uppercased characters and all remaining cased characters have lower case.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required

uppercase(*, text)

Return a copy of the string converted to uppercase.

Parameters:

Name Type Description Default
text str

The text that will be used in the operation.

required