QgsStringReplacement class

A representation of a single string replacement.

Public static functions

static auto fromProperties(const QgsStringMap& properties) -> QgsStringReplacement
Creates a new QgsStringReplacement from an encoded properties map.

Constructors, destructors, conversion operators

QgsStringReplacement(const QString& match, const QString& replacement, bool caseSensitive = false, bool wholeWordOnly = false)
Constructor for QgsStringReplacement.

Public functions

auto caseSensitive() const -> bool
Returns true if match is case sensitive.
auto match() const -> QString
Returns the string matched by this object.
auto process(const QString& input) const -> QString
Processes a given input string, applying any valid replacements which should be made.
auto properties() const -> QgsStringMap
Returns a map of the replacement properties.
auto replacement() const -> QString
Returns the string to replace matches with.
auto wholeWordOnly() const -> bool
Returns true if match only applies to whole words, or false if partial word matches are permitted.

Function documentation

static QgsStringReplacement QgsStringReplacement::fromProperties(const QgsStringMap& properties)

Creates a new QgsStringReplacement from an encoded properties map.

QgsStringReplacement::QgsStringReplacement(const QString& match, const QString& replacement, bool caseSensitive = false, bool wholeWordOnly = false)

Constructor for QgsStringReplacement.

Parameters
match string to match
replacement string to replace match with
caseSensitive set to true for a case sensitive match
wholeWordOnly set to true to match complete words only, or false to allow partial word matches

QString QgsStringReplacement::process(const QString& input) const

Processes a given input string, applying any valid replacements which should be made.

Parameters
input input string
Returns input string with any matches replaced by replacement string

QgsStringMap QgsStringReplacement::properties() const

Returns a map of the replacement properties.