TextPlugin Class
TextPlugin provides a set of functions to manipulate strings.
Usage: kernel.add_plugin(TextPlugin(), plugin_name="text")
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
Constructor
TextPlugin()
Examples
KernelArguments["input"] = " hello world " {{text.trim $input}} => "hello world"KernelArguments["input"] = " hello world " {{text.trimStart $input}} => "hello world "KernelArguments["input"] = " hello world " {{text.trimEnd $input}} => " hello world"KernelArguments["input"] = "hello world" {{text.uppercase $input}} => "HELLO WORLD"KernelArguments["input"] = "HELLO WORLD" {{text.lowercase $input}} => "hello world"
Methods
| lowercase |
Convert a string to lowercase. |
| trim |
Trim whitespace from the start and end of a string. |
| trim_end |
Trim whitespace from the end of a string. |
| trim_start |
Trim whitespace from the start of a string. |
| uppercase |
Convert a string to uppercase. |
lowercase
Convert a string to lowercase.
lowercase(input: str) -> str
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
Examples
KernelArguments["input"] = "HELLO WORLD" {{input.lowercase $input}} => "hello world"
trim
Trim whitespace from the start and end of a string.
trim(input: str) -> str
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
Examples
KernelArguments["input"] = " hello world " {{text.trim $input}} => "hello world"
trim_end
Trim whitespace from the end of a string.
trim_end(input: str) -> str
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
Examples
KernelArguments["input"] = " hello world " {{input.trim $input}} => " hello world"
trim_start
Trim whitespace from the start of a string.
trim_start(input: str) -> str
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
Examples
KernelArguments["input"] = " hello world " {{input.trim $input}} => "hello world "
uppercase
Convert a string to uppercase.
uppercase(input: str) -> str
Parameters
| Name | Description |
|---|---|
|
input
Required
|
|
Examples
KernelArguments["input"] = "hello world" {{input.uppercase $input}} => "HELLO WORLD"