LibreOffice Module sc (master)  1
Functions
naturalsort Namespace Reference

Functions

static bool SplitString (const OUString &sWhole, OUString &sPrefix, OUString &sSuffix, double &fNum)
 Splits a given string into three parts: the prefix, number string, and the suffix. More...
 
static short Compare (const OUString &sInput1, const OUString &sInput2, const bool bCaseSens, const ScUserListData *pData, const CollatorWrapper *pCW)
 Naturally compares two given strings. More...
 

Function Documentation

static short naturalsort::Compare ( const OUString &  sInput1,
const OUString &  sInput2,
const bool  bCaseSens,
const ScUserListData pData,
const CollatorWrapper pCW 
)
static

Naturally compares two given strings.

This is the main function that should be called externally. It returns either 1, 0, or -1 depending on the comparison result of given two strings.

Parameters
sInput1Input string 1
sInput2Input string 2
bCaseSensBoolean value for case sensitivity
pDataPointer to user defined sort list
pCWPointer to collator wrapper for normal string comparison
Returns
Returns 1 if sInput1 is greater, 0 if sInput1 == sInput2, and -1 if sInput2 is greater.

Definition at line 163 of file table3.cxx.

References ScUserListData::Compare(), CollatorWrapper::compareString(), ScUserListData::ICompare(), and SplitString().

Referenced by ScTable::CompareCell(), ScTable::IsSorted(), ScInterpreter::ScEqual(), ScInterpreter::ScGreater(), ScInterpreter::ScGreaterEqual(), ScInterpreter::ScLess(), ScInterpreter::ScLessEqual(), and ScInterpreter::ScNotEqual().

static bool naturalsort::SplitString ( const OUString &  sWhole,
OUString &  sPrefix,
OUString &  sSuffix,
double &  fNum 
)
static

Splits a given string into three parts: the prefix, number string, and the suffix.

Parameters
sWholeOriginal string to be split into pieces
sPrefixPrefix string that consists of the part before the first number token. If no number was found, sPrefix is unchanged.
sSuffixString after the last number token. This may still contain number strings. If no number was found, sSuffix is unchanged.
fNumNumber converted from the middle number string If no number was found, fNum is unchanged.
Returns
Returns TRUE if a numeral element is found in a given string, or FALSE if no numeral element is found.

Definition at line 103 of file table3.cxx.

References CharClass::getCharacterType(), ScGlobal::getCharClassPtr(), ScGlobal::getLocaleDataPtr(), LocaleDataWrapper::getNumDecimalSep(), nPos, nType, CharClass::parsePredefinedToken(), and SAL_WARN.

Referenced by Compare().