QGIS API Documentation  2.14.11-Essen
qgsstringutils.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsstringutils.h
3  ----------------
4  begin : June 2015
5  copyright : (C) 2015 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
16 #include <QString>
17 #include <QFont> // for enum values
18 
19 #ifndef QGSSTRINGUTILS_H
20 #define QGSSTRINGUTILS_H
21 
28 class CORE_EXPORT QgsStringUtils
29 {
30  public:
31 
34  {
35  MixedCase = QFont::MixedCase,
36  AllUppercase = QFont::AllUppercase,
37  AllLowercase = QFont::AllLowercase,
38  ForceFirstLetterToCapital = QFont::Capitalize,
39  };
40 
47  static QString capitalize( const QString& string, Capitalization capitalization );
48 
57  static int levenshteinDistance( const QString &string1, const QString &string2, bool caseSensitive = false );
58 
67  static QString longestCommonSubstring( const QString &string1, const QString &string2, bool caseSensitive = false );
68 
77  static int hammingDistance( const QString &string1, const QString &string2, bool caseSensitive = false );
78 
84  static QString soundex( const QString &string );
85 };
86 
87 #endif //QGSSTRINGUTILS_H
Capitalization
Capitalization options.
Utility functions for working with strings.