Class: QgsStringReplacementCollection¶
- class qgis.core.QgsStringReplacementCollection¶
Bases:
sip.wrapper
A collection of string replacements (specified using
QgsStringReplacement
objects).QgsStringReplacementCollection(replacements: Iterable[QgsStringReplacement] = []) Constructor for QgsStringReplacementCollection
- Parameters:
replacements – initial list of string replacements
QgsStringReplacementCollection(
QgsStringReplacementCollection
)Methods
Processes a given input string, applying any valid replacements which should be made using
QgsStringReplacement
objects contained by this collection.Reads the collection state from an XML element.
Returns the list of string replacements in this collection.
Sets the list of string replacements in this collection.
Writes the collection state to an XML element.
- process(self, input: str) str ¶
Processes a given input string, applying any valid replacements which should be made using
QgsStringReplacement
objects contained by this collection. Replacements are made in order of theQgsStringReplacement
objects contained in the collection.- Parameters:
input (str) – input string
- Return type:
str
- Returns:
input string with any matches replaced by replacement string
- readXml(self, elem: QDomElement)¶
Reads the collection state from an XML element.
- Parameters:
elem (QDomElement) – DOM element
See also
- replacements(self) List[QgsStringReplacement] ¶
Returns the list of string replacements in this collection.
See also
- Return type:
List[QgsStringReplacement]
- setReplacements(self, replacements: Iterable[QgsStringReplacement])¶
Sets the list of string replacements in this collection.
- Parameters:
replacements (Iterable[QgsStringReplacement]) – list of string replacements to apply. Replacements are applied in the order they are specified here.
See also