Class: QgsStringReplacementCollection

class qgis.core.QgsStringReplacementCollection(replacements: Iterable[QgsStringReplacement] = [])

Bases: sip.wrapper

Constructor for QgsStringReplacementCollection

Parameters

replacements – initial list of string replacements

QgsStringReplacementCollection(QgsStringReplacementCollection)

A collection of string replacements (specified using QgsStringReplacement objects).

New in version 3.0: Enums

Methods

process

Processes a given input string, applying any valid replacements which should be made using QgsStringReplacement objects contained by this collection.

readXml

Reads the collection state from an XML element.

replacements

Returns the list of string replacements in this collection.

setReplacements

Sets the list of string replacements in this collection.

writeXml

Writes the collection state to an XML element.

Signals

Attributes

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 the QgsStringReplacement objects contained in the collection.

Parameters

input – input string

Returns

input string with any matches replaced by replacement string

readXml(self, elem: QDomElement)

Reads the collection state from an XML element.

Parameters

elem – DOM element

See also

writeXml()

replacements(self) → List[QgsStringReplacement]

Returns the list of string replacements in this collection.

setReplacements(self, replacements: Iterable[QgsStringReplacement])

Sets the list of string replacements in this collection.

Parameters

replacements – list of string replacements to apply. Replacements are applied in the order they are specified here.

See also

replacements()

writeXml(self, elem: QDomElement, doc: QDomDocument)

Writes the collection state to an XML element.

Parameters
  • elem – target DOM element

  • doc – DOM document

See also

readXml()