QGIS API Documentation  3.8.0-Zanzibar (11aff65)
Public Member Functions | Static Public Member Functions | List of all members
QgsStringReplacement Class Reference

A representation of a single string replacement. More...

#include <qgsstringutils.h>

Public Member Functions

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

Static Public Member Functions

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

Detailed Description

A representation of a single string replacement.

Since
QGIS 3.0

Definition at line 35 of file qgsstringutils.h.

Constructor & Destructor Documentation

◆ QgsStringReplacement()

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

Constructor for QgsStringReplacement.

Parameters
matchstring to match
replacementstring to replace match with
caseSensitiveset to true for a case sensitive match
wholeWordOnlyset to true to match complete words only, or false to allow partial word matches

Definition at line 521 of file qgsstringutils.cpp.

Member Function Documentation

◆ caseSensitive()

bool QgsStringReplacement::caseSensitive ( ) const
inline

Returns true if match is case sensitive.

Definition at line 59 of file qgsstringutils.h.

◆ fromProperties()

QgsStringReplacement QgsStringReplacement::fromProperties ( const QgsStringMap properties)
static

Creates a new QgsStringReplacement from an encoded properties map.

See also
properties()

Definition at line 555 of file qgsstringutils.cpp.

◆ match()

QString QgsStringReplacement::match ( ) const
inline

Returns the string matched by this object.

Definition at line 53 of file qgsstringutils.h.

◆ operator==()

bool QgsStringReplacement::operator== ( const QgsStringReplacement other)
inline

Definition at line 71 of file qgsstringutils.h.

◆ process()

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

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

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

Definition at line 532 of file qgsstringutils.cpp.

◆ properties()

QgsStringMap QgsStringReplacement::properties ( ) const

Returns a map of the replacement properties.

See also
fromProperties()

Definition at line 545 of file qgsstringutils.cpp.

◆ replacement()

QString QgsStringReplacement::replacement ( ) const
inline

Returns the string to replace matches with.

Definition at line 56 of file qgsstringutils.h.

◆ wholeWordOnly()

bool QgsStringReplacement::wholeWordOnly ( ) const
inline

Returns true if match only applies to whole words, or false if partial word matches are permitted.

Definition at line 62 of file qgsstringutils.h.


The documentation for this class was generated from the following files: