QGIS API Documentation
2.18.21-Las Palmas (9fba24a)
|
Utility functions for working with strings. More...
#include <qgsstringutils.h>
Public Types | |
enum | Capitalization { MixedCase = QFont::MixedCase, AllUppercase = QFont::AllUppercase, AllLowercase = QFont::AllLowercase, ForceFirstLetterToCapital = QFont::Capitalize } |
Capitalization options. More... | |
Static Public Member Functions | |
static QString | capitalize (const QString &string, Capitalization capitalization) |
Converts a string by applying capitalization rules to the string. More... | |
static int | hammingDistance (const QString &string1, const QString &string2, bool caseSensitive=false) |
Returns the Hamming distance between two strings. More... | |
static QString | insertLinks (const QString &string, bool *foundLinks=nullptr) |
Returns a string with any URL (eg http(s)/ftp) and mailto: text converted to valid HTML <a ...> links. More... | |
static int | levenshteinDistance (const QString &string1, const QString &string2, bool caseSensitive=false) |
Returns the Levenshtein edit distance between two strings. More... | |
static QString | longestCommonSubstring (const QString &string1, const QString &string2, bool caseSensitive=false) |
Returns the longest common substring between two strings. More... | |
static QString | soundex (const QString &string) |
Returns the Soundex representation of a string. More... | |
Utility functions for working with strings.
Definition at line 166 of file qgsstringutils.h.
Capitalization options.
Definition at line 171 of file qgsstringutils.h.
|
static |
Converts a string by applying capitalization rules to the string.
string | input string |
capitalization | capitalization type to apply |
Definition at line 23 of file qgsstringutils.cpp.
|
static |
Returns the Hamming distance between two strings.
This equates to the number of characters at corresponding positions within the input strings where the characters are different. The input strings must be the same length.
string1 | first string |
string2 | second string |
caseSensitive | set to true for case sensitive comparison |
Definition at line 215 of file qgsstringutils.cpp.
Returns a string with any URL (eg http(s)/ftp) and mailto: text converted to valid HTML <a ...> links.
string | string to insert links into |
foundLinks | if specified, will be set to true if any links were inserted into the string |
Definition at line 349 of file qgsstringutils.cpp.
|
static |
Returns the Levenshtein edit distance between two strings.
This equates to the minimum number of character edits (insertions, deletions or substitutions) required to change one string to another.
string1 | first string |
string2 | second string |
caseSensitive | set to true for case sensitive comparison |
Definition at line 70 of file qgsstringutils.cpp.
|
static |
Returns the longest common substring between two strings.
This substring is the longest string that is a substring of the two input strings. Eg, the longest common substring of "ABABC" and "BABCA" is "ABC".
string1 | first string |
string2 | second string |
caseSensitive | set to true for case sensitive comparison |
Definition at line 152 of file qgsstringutils.cpp.
Returns the Soundex representation of a string.
Soundex is a phonetic matching algorithm, so strings with similar sounds should be represented by the same Soundex code.
string | input string |
Definition at line 254 of file qgsstringutils.cpp.