launch.substitutions.string_join_substitution module
Module for the StringJoinSubstitution substitution.
- class launch.substitutions.string_join_substitution.StringJoinSubstitution[source]
Bases:
SubstitutionSubstitution that joins strings and/or other substitutions.
This takes in a list of string components as substitutions. The substitutions for each string component are performed and concatenated, and then all string components are joined with a specified delimiter as seperation.
For example:
subdomain = LaunchConfiguration(variable_name='subdomain', default='docs') url = StringJoinSubstitution( [['https', '://', subdomain], 'ros', 'org'], delimiter='.' )
<launch> <arg name="subdomain" default="docs"/> <let name="url" value="$(string-join . https://$(var subdomain) ros org)"/> </launch>
launch: - arg: name: subdomain default: "docs" - let: name: url value: "$(string-join . https://$(var subdomain) ros org)"
If the
subdomainlaunch configuration was set todocsand thedelimiterto., then any of the above launch descriptions would result in a string equal to'https://docs.ros.org'- __init__(substitutions: Iterable[str | Path | Substitution | Iterable[str | Path | Substitution]], delimiter: str | Path | Substitution | Iterable[str | Path | Substitution] = '') None[source]
Create a StringJoinSubstitution.
- Parameters:
substitutions – the list of string component substitutions to join
delimiter – the text inbetween two consecutive components (default no text)
- property delimiter: List[Substitution]
Getter for delimiter.
- classmethod parse(data: Sequence[str | Path | Substitution | Iterable[str | Path | Substitution]]) Tuple[Type[StringJoinSubstitution], Dict[str, Any]][source]
Parse StringJoinSubstitution substitution.
- perform(context: LaunchContext) str[source]
Perform the substitution by retrieving the local variable.
- property substitutions: List[List[Substitution]]
Getter for substitutions.