LibreOffice Module comphelper (master)
1
|
Namespaces | |
detail | |
Classes | |
class | NaturalStringSorter |
Functions | |
OString | stripStart (const OString &rIn, char c) |
Strips occurrences of a character from the start of the source string. More... | |
OUString | stripStart (const OUString &rIn, sal_Unicode c) |
Strips occurrences of a character from the start of the source string. More... | |
OString | stripEnd (const OString &rIn, char c) |
Strips occurrences of a character from the end of the source string. More... | |
OUString | stripEnd (const OUString &rIn, sal_Unicode c) |
Strips occurrences of a character from the end of the source string. More... | |
OString | strip (const OString &rIn, char c) |
Strips occurrences of a character from the start and end of the source string. More... | |
OUString | strip (const OUString &rIn, sal_Unicode c) |
Strips occurrences of a character from the start and end of the source string. More... | |
sal_Int32 | getTokenCount (const OString &rIn, char cTok) |
Returns number of tokens in an OUString. More... | |
sal_Int32 | getTokenCount (const OUString &rIn, sal_Unicode cTok) |
Returns number of tokens in an OUString. More... | |
static sal_uInt32 | decimalStringToNumber (OUString const &str, sal_Int32 nStart, sal_Int32 nLength) |
sal_uInt32 | decimalStringToNumber (OUString const &str) |
Convert a decimal string to a number. More... | |
OUString | convertCommaSeparated (uno::Sequence< OUString > const &i_rSeq) |
std::vector< OUString > | split (const OUString &rStr, sal_Unicode cSeparator) |
uno::Sequence< OUString > | convertCommaSeparated (OUString const &i_rString) |
Convert a single comma separated string to a sequence of strings. More... | |
OString | join (const OString &rSeparator, const std::vector< OString > &rSequence) |
Return a string which is the concatenation of the strings in the sequence. More... | |
sal_Int32 | compareNatural (const OUString &rLHS, const OUString &rRHS, const uno::Reference< i18n::XCollator > &rCollator, const uno::Reference< i18n::XBreakIterator > &rBI, const lang::Locale &rLocale) |
bool | isdigitAsciiString (const OString &rString) |
Determine if an OString contains solely ASCII numeric digits. More... | |
bool | isdigitAsciiString (const OUString &rString) |
Determine if an OUString contains solely ASCII numeric digits. More... | |
OUString | reverseString (const OUString &rStr) |
Reverse an OUString. More... | |
OString | reverseString (const OString &rStr) |
Reverse an OString. More... | |
sal_Int32 | indexOfAny (OUString const &rIn, sal_Unicode const *const pChars, sal_Int32 const nPos) |
Find any of a list of code units in the string. More... | |
OUString | removeAny (OUString const &rIn, sal_Unicode const *const pChars) |
Remove any of a list of code units in the string. More... | |
OUString | setToken (const OUString &rIn, sal_Int32 nToken, sal_Unicode cTok, const OUString &rNewToken) |
Replace a token in a string. More... | |
OUStringBuffer & | remove (OUStringBuffer &rIn, sal_Unicode c) |
Removes all occurrences of a character from within the source string. More... | |
OUStringBuffer & | truncateToLength (OUStringBuffer &rBuffer, sal_Int32 nLength) |
Truncate a buffer to a given length. More... | |
OStringBuffer & | padToLength (OStringBuffer &rBuffer, sal_Int32 nLength, char cFill= '\0') |
Pad a buffer to a given length using a given char. More... | |
OUStringBuffer & | padToLength (OUStringBuffer &rBuffer, sal_Int32 nLength, sal_Unicode cFill= '\0') |
COMPHELPER_DLLPUBLIC OUString | convertCommaSeparated (css::uno::Sequence< OUString > const &i_rSeq) |
Convert a sequence of strings to a single comma separated string. More... | |
COMPHELPER_DLLPUBLIC sal_Int32 | compareNatural (const OUString &rLHS, const OUString &rRHS, const css::uno::Reference< css::i18n::XCollator > &rCollator, const css::uno::Reference< css::i18n::XBreakIterator > &rBI, const css::lang::Locale &rLocale) |
Compares two strings using natural order. More... | |
sal_Int32 comphelper::string::compareNatural | ( | const OUString & | rLHS, |
const OUString & | rRHS, | ||
const uno::Reference< i18n::XCollator > & | rCollator, | ||
const uno::Reference< i18n::XBreakIterator > & | rBI, | ||
const lang::Locale & | rLocale | ||
) |
Definition at line 301 of file string.cxx.
References decimalStringToNumber().
Referenced by comphelper::string::NaturalStringSorter::compare().
COMPHELPER_DLLPUBLIC sal_Int32 comphelper::string::compareNatural | ( | const OUString & | rLHS, |
const OUString & | rRHS, | ||
const css::uno::Reference< css::i18n::XCollator > & | rCollator, | ||
const css::uno::Reference< css::i18n::XBreakIterator > & | rBI, | ||
const css::lang::Locale & | rLocale | ||
) |
Compares two strings using natural order.
For non digit characters, the comparison use the same algorithm as rtl_str_compare. When a number is encountered during the comparison, natural order is used. Thus, Heading 10 will be considered as greater than Heading 2. Numerical comparison is done using decimal representation.
Beware that "MyString 001" and "MyString 1" will be considered as equal since leading 0 are meaningless.
str | the object to be compared. |
OUString comphelper::string::convertCommaSeparated | ( | uno::Sequence< OUString > const & | i_rSeq | ) |
Definition at line 253 of file string.cxx.
References comphelper::intersperse().
COMPHELPER_DLLPUBLIC OUString comphelper::string::convertCommaSeparated | ( | css::uno::Sequence< OUString > const & | i_rSeq | ) |
Convert a sequence of strings to a single comma separated string.
Note that no escaping of commas or anything fancy is done.
i_rSeq | A list of strings to be concatenated. |
COMPHELPER_DLLPUBLIC css::uno::Sequence< OUString > comphelper::string::convertCommaSeparated | ( | OUString const & | i_rString | ) |
Convert a single comma separated string to a sequence of strings.
Note that no escaping of commas or anything fancy is done.
i_rString | A string containing comma-separated words. |
Definition at line 283 of file string.cxx.
References comphelper::containerToSequence(), and split().
|
static |
Definition at line 146 of file string.cxx.
Referenced by compareNatural(), and decimalStringToNumber().
COMPHELPER_DLLPUBLIC sal_uInt32 comphelper::string::decimalStringToNumber | ( | OUString const & | str | ) |
Convert a decimal string to a number.
The string must be base-10, no sign but can contain any codepoint listed in the "Number, Decimal Digit" Unicode category.
No verification is made about the validity of the string, passing string not containing decimal digit code points gives unspecified results
If your string is guaranteed to contain only ASCII digit use OUString::toInt32 instead.
str | The string to convert containing only decimal digit codepoints. |
Definition at line 243 of file string.cxx.
References decimalStringToNumber().
COMPHELPER_DLLPUBLIC sal_Int32 comphelper::string::getTokenCount | ( | const OString & | rIn, |
char | cTok | ||
) |
Returns number of tokens in an OUString.
rIn | the input OString |
cTok | the character which separate the tokens. |
Definition at line 136 of file string.cxx.
COMPHELPER_DLLPUBLIC sal_Int32 comphelper::string::getTokenCount | ( | const OUString & | rIn, |
sal_Unicode | cTok | ||
) |
Returns number of tokens in an OUString.
rIn | the input OUString |
cTok | the character which separate the tokens. |
Definition at line 141 of file string.cxx.
COMPHELPER_DLLPUBLIC sal_Int32 comphelper::string::indexOfAny | ( | OUString const & | rIn, |
sal_Unicode const *const | pChars, | ||
sal_Int32 const | nPos | ||
) |
Find any of a list of code units in the string.
rIn | OUString to search |
pChars | 0-terminated array of sal_Unicode code units to search for |
nPos | start position |
Definition at line 412 of file string.cxx.
References pChar.
COMPHELPER_DLLPUBLIC bool comphelper::string::isdigitAsciiString | ( | const OString & | rString | ) |
Determine if an OString contains solely ASCII numeric digits.
rString | An OString |
Definition at line 373 of file string.cxx.
COMPHELPER_DLLPUBLIC bool comphelper::string::isdigitAsciiString | ( | const OUString & | rString | ) |
Determine if an OUString contains solely ASCII numeric digits.
rString | An OUString |
Definition at line 380 of file string.cxx.
COMPHELPER_DLLPUBLIC OString comphelper::string::join | ( | const OString & | rSeparator, |
const std::vector< OString > & | rSequence | ||
) |
Return a string which is the concatenation of the strings in the sequence.
Definition at line 289 of file string.cxx.
References aBuffer.
|
inline |
Pad a buffer to a given length using a given char.
If the StringBuffer has less characters than nLength it will be expanded on the right to nLength characters, with the expansion filled using cFill.
Has no effect if the StringBuffer is >= nLength
rBuf | StringBuffer to operate on |
nLength | Length to pad the buffer to |
cFill | character to fill expansion with |
Definition at line 214 of file string.hxx.
References comphelper::string::detail::padToLength().
|
inline |
Definition at line 221 of file string.hxx.
References comphelper::string::detail::padToLength().
|
inline |
Removes all occurrences of a character from within the source string.
rIn | The input OUStringBuffer |
c | The character to be removed |
Definition at line 50 of file string.hxx.
References index.
Referenced by comphelper::DirectoryHelper::deleteDirRecursively(), comphelper::DirectoryHelper::moveDirContent(), comphelper::BackupFileHelper::reactOnSafeMode(), comphelper::BackupFileHelper::tryDisableHWAcceleration(), comphelper::BackupFileHelper::tryPop(), comphelper::BackupFileHelper::tryPop_extensionInfo(), comphelper::BackupFileHelper::tryPop_file(), comphelper::BackupFileHelper::tryPop_files(), comphelper::BackupFileHelper::tryPopExtensionInfo(), comphelper::BackupFileHelper::tryPush_extensionInfo(), comphelper::BackupFileHelper::tryPush_Files(), and comphelper::BackupFileHelper::tryResetCustomizations().
COMPHELPER_DLLPUBLIC OUString comphelper::string::removeAny | ( | OUString const & | rIn, |
sal_Unicode const *const | pChars | ||
) |
Remove any of a list of code units in the string.
rIn | OUString to search |
pChars | 0-terminated array of sal_Unicode code units to search for |
Definition at line 429 of file string.cxx.
References pChar.
COMPHELPER_DLLPUBLIC OUString comphelper::string::reverseString | ( | const OUString & | rStr | ) |
Reverse an OUString.
rIn | the input OUString |
Definition at line 402 of file string.cxx.
COMPHELPER_DLLPUBLIC OString comphelper::string::reverseString | ( | const OString & | rStr | ) |
Reverse an OString.
rIn | the input OString |
Definition at line 407 of file string.cxx.
COMPHELPER_DLLPUBLIC OUString comphelper::string::setToken | ( | const OUString & | rIn, |
sal_Int32 | nToken, | ||
sal_Unicode | cTok, | ||
const OUString & | rNewToken | ||
) |
Replace a token in a string.
rIn | OUString in which the token is to be replaced |
nToken | which nToken to replace |
cTok | token delimiter |
rNewToken | replacement token |
Definition at line 465 of file string.cxx.
COMPHELPER_DLLPUBLIC std::vector< OUString > comphelper::string::split | ( | const OUString & | rStr, |
sal_Unicode | cSeparator | ||
) |
COMPHELPER_DLLPUBLIC OString comphelper::string::strip | ( | const OString & | rIn, |
char | c | ||
) |
Strips occurrences of a character from the start and end of the source string.
rIn | The input OString |
c | The character to be stripped from the start and end |
Definition at line 107 of file string.cxx.
References stripEnd(), and stripStart().
COMPHELPER_DLLPUBLIC OUString comphelper::string::strip | ( | const OUString & | rIn, |
sal_Unicode | c | ||
) |
Strips occurrences of a character from the start and end of the source string.
rIn | The input OUString |
c | The character to be stripped from the start and end |
Definition at line 112 of file string.cxx.
References stripEnd(), and stripStart().
COMPHELPER_DLLPUBLIC OString comphelper::string::stripEnd | ( | const OString & | rIn, |
char | c | ||
) |
Strips occurrences of a character from the end of the source string.
rIn | The input OString |
c | The character to be stripped from the end |
Definition at line 97 of file string.cxx.
Referenced by strip().
COMPHELPER_DLLPUBLIC OUString comphelper::string::stripEnd | ( | const OUString & | rIn, |
sal_Unicode | c | ||
) |
Strips occurrences of a character from the end of the source string.
rIn | The input OUString |
c | The character to be stripped from the end |
Definition at line 102 of file string.cxx.
COMPHELPER_DLLPUBLIC OString comphelper::string::stripStart | ( | const OString & | rIn, |
char | c | ||
) |
Strips occurrences of a character from the start of the source string.
rIn | The input OString |
c | The character to be stripped from the start |
Definition at line 66 of file string.cxx.
Referenced by strip().
COMPHELPER_DLLPUBLIC OUString comphelper::string::stripStart | ( | const OUString & | rIn, |
sal_Unicode | c | ||
) |
Strips occurrences of a character from the start of the source string.
rIn | The input OUString |
c | The character to be stripped from the start |
Definition at line 71 of file string.cxx.
|
inline |
Truncate a buffer to a given length.
If the StringBuffer has more characters than nLength it will be truncated on the right to nLength characters.
Has no effect if the StringBuffer is <= nLength
rBuf | StringBuffer to operate on |
nLength | Length to truncate the buffer to |
Definition at line 179 of file string.hxx.
References comphelper::string::detail::truncateToLength().