Class: QgsStringReplacement¶
- class qgis.core.QgsStringReplacement¶
Bases:
sip.wrapper
A representation of a single string replacement.
New in version 3.0.
QgsStringReplacement(match: str, replacement: str, caseSensitive: bool = False, wholeWordOnly: bool = False) Constructor for QgsStringReplacement.
- Parameters:
match – string to match
replacement – string to replace match with
caseSensitive – set to
True
for a case sensitive matchwholeWordOnly – set to
True
to match complete words only, orFalse
to allow partial word matches
QgsStringReplacement(
QgsStringReplacement
)Methods
Returns
True
if match is case sensitiveCreates a new
QgsStringReplacement
from an encoded properties map.Returns the string matched by this object
Processes a given input string, applying any valid replacements which should be made.
Returns a map of the replacement properties.
Returns the string to replace matches with
Returns
True
if match only applies to whole words, orFalse
if partial word matches are permitted- caseSensitive(self) bool ¶
Returns
True
if match is case sensitive- Return type:
bool
- fromProperties(properties: Dict[str, str]) QgsStringReplacement ¶
Creates a new
QgsStringReplacement
from an encoded properties map.See also
- Parameters:
properties (Dict[str) –
- Return type:
- match(self) str ¶
Returns the string matched by this object
- Return type:
str
- process(self, input: str) str ¶
Processes a given input string, applying any valid replacements which should be made.
- Parameters:
input (str) – input string
- Return type:
str
- Returns:
input string with any matches replaced by replacement string
- properties(self) Dict[str, str] ¶
Returns a map of the replacement properties.
See also
- Return type:
Dict[str, str]
- replacement(self) str ¶
Returns the string to replace matches with
- Return type:
str
- wholeWordOnly(self) bool ¶
Returns
True
if match only applies to whole words, orFalse
if partial word matches are permitted- Return type:
bool