lstautorta.utils.string
Functions:
| Name | Description |
|---|---|
split_string_around_multiple_template_vars |
Returns a list of substring in string, using |
split_string_around_template_var |
Return a list of substring in string, using |
substrings_in_string |
Check if |
split_string_around_multiple_template_vars
Returns a list of substring in string, using var_identifier{...} as the delimiter for all var_identifier
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
String to split. |
required |
var_identifiers
|
List[str]
|
List of strings used to indicate the start of a template variable. For instance ["@", "$"] means that "@{...}" and "${...}" will be used as delimiter to split the string. |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List of substrings in string, splitted using the template variables found with |
Source code in src/lstautorta/utils/string.py
split_string_around_template_var
Return a list of substring in string, using var_identifier{...} as the delimiter, where ... can be anything
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
Input string to split. |
required |
var_identifier
|
str
|
String used to indicate the start of a template variable. Eg "@" indicates that "@{t}" uses template variable |
required |
Returns:
| Type | Description |
|---|---|
List[str]
|
List of substrings in string, splitted using the template variables found with |
Examples:
>>> split_string_around_template_var("@{tel_id}_§{processIndex}_r0_dl1", "§")
["@{tel_id}_", "_r0_dl1"]
Source code in src/lstautorta/utils/string.py
substrings_in_string
Check if substrings appear in order in string (can be arbitrary content between substrings)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
string
|
str
|
String to check |
required |
substrings
|
List[str]
|
List of substrings to search in |
required |
Returns:
| Type | Description |
|---|---|
bool
|
True if all sub-strings appear in order in |