Open-Typer
Open source typewriting tutor program
Loading...
Searching...
No Matches
StringUtils Class Reference

The StringUtils class contains functions related to strings. More...

#include "framework/global/internal/StringUtils.h"

Inheritance diagram for StringUtils:
Collaboration diagram for StringUtils:

Public Member Functions

Q_INVOKABLE int wordCount (QString str) override
 
Q_INVOKABLE int charCount (QString str, QChar ch) override
 
Q_INVOKABLE QString word (QString str, int id) override
 
Q_INVOKABLE QString wordAt (QString str, int index) override
 
Q_INVOKABLE QString repeatString (QString string, int n) override
 
Q_INVOKABLE QList< QVariant > longestCommonSubsequence (QList< QVariant > source, QList< QVariant > target) override
 
Q_INVOKABLE QString longestCommonSubsequence (QString source, QString target) override
 
Q_INVOKABLE QString normalizeString (QString str) override
 

Static Public Member Functions

static std::shared_ptr< StringUtilsinstance ()
 

Static Private Member Functions

static int lcsLen (QList< QVariant > source, QList< QVariant > target)
 
static int lcsLen (QList< QVariant > source, QList< QVariant > target, QMap< int, QMap< int, int > > *lcsTable)
 

Static Private Attributes

static std::shared_ptr< StringUtilsm_instance = std::make_shared<StringUtils>()
 

Detailed Description

The StringUtils class contains functions related to strings.

Member Function Documentation

◆ charCount()

int StringUtils::charCount ( QString  str,
QChar  ch 
)
overridevirtual

Returns count of the given character in the string.

Implements IStringUtils.

◆ instance()

std::shared_ptr< StringUtils > StringUtils::instance ( )
static

Returns the static instance of StringUtils.

◆ lcsLen()

int StringUtils::lcsLen ( QList< QVariant >  source,
QList< QVariant >  target 
)
staticprivate

Returns the length of the longest common subsequence of source and target list.

◆ longestCommonSubsequence() [1/2]

QList< QVariant > StringUtils::longestCommonSubsequence ( QList< QVariant >  source,
QList< QVariant >  target 
)
overridevirtual

Returns the longest common subsequence of source and target list.

Implements IStringUtils.

◆ longestCommonSubsequence() [2/2]

QString StringUtils::longestCommonSubsequence ( QString  source,
QString  target 
)
overridevirtual

Returns the longest common subsequence of source and target string.

Implements IStringUtils.

◆ normalizeString()

QString StringUtils::normalizeString ( QString  str)
overridevirtual

Normalizes the given string.

Implements IStringUtils.

◆ repeatString()

QString StringUtils::repeatString ( QString  string,
int  n 
)
overridevirtual

Returns repeated string. Same as string.repeated(n).

Implements IStringUtils.

◆ word()

QString StringUtils::word ( QString  str,
int  id 
)
overridevirtual

Returns a word in the string.

Implements IStringUtils.

◆ wordAt()

QString StringUtils::wordAt ( QString  str,
int  index 
)
overridevirtual

Returns the word at index.

Implements IStringUtils.

◆ wordCount()

int StringUtils::wordCount ( QString  str)
overridevirtual

Returns number of words in the string.

Implements IStringUtils.


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