|
cxWidgets 1.0
|
String utility functions. More...
Functions | |
| void | SplitStringRegex (const std::string &input, const std::string ®ex, std::vector< std::string > &resultContainer) |
| bool | Find (const std::string &input, const std::string ®ex, bool useBasicRegex=false) |
| void | Find (const std::string &input, const std::string ®ex, std::string &output) |
| bool | Replace (std::string &srcStr, const std::string ®exStr, const std::string &replacementStr) |
| std::string | replace (const std::string &input, const std::string &search, const std::string &replace) |
| Replaces substrings of a string with another string. | |
| int | stringTo (const std::string &s) |
| Converts a string to another type. | |
| long | stringToLong (const std::string &s) |
| unsigned | stringToUnsigned (const std::string &s) |
| double | stringToDouble (const std::string &s) |
| long double | stringToLongDouble (const std::string &s) |
| std::string | stringToString (const std::string &s) |
| void | test_stringTo () |
| std::string | toString (const int &x) |
| Converts an object to a string, i.e.: | |
| std::string | toString (const long &x) |
| std::string | toString (const double &x) |
| std::string | toString (const long double &x) |
| std::string | toString (const unsigned &x) |
| std::string | toString (const unsigned long &x) |
| std::string | toString (const cx::eReturnCode &x) |
| std::string | toString (const cx::eInputOptions &x) |
| std::string | toString (const cx::eBorderStyle &x) |
| std::string | toString (const void *x) |
| void | test_toString () |
| bool | startsWithNumber (const std::string &pStr) |
| bool | isPrintable (const int &pKey) |
| Returns whether or not a key is printable. This should be used. | |
| int | indexOfLastCap (const std::string &pStr) |
| Returns the index of the last capital letter in a string. Returns -1 if there are no capital letters. | |
| void | toUpper (std::string &theString) |
| Converts a string to upper-case. | |
| std::string | stripNewlines (const std::string &pStr) |
| Strips newlines characters from a string and returns. | |
| std::string | replaceNewlines (const std::string &pStr, const char &pChar) |
| Replaces newlines in a string with another character. | |
| void | insertUnderline (std::string &pStr, char pChar, bool pAll=false) |
| Inserts an underline character into. | |
| std::string | removeChar (const std::string &pString, const int pPos) |
| Removes a character from a string. | |
| std::string | strToUpper (const std::string &theString) |
| conver the string to upper case | |
| std::string | strToLower (const std::string &theString) |
| conver the string to lower case | |
| void | TrimSpaces (std::string &str) |
| Trims leading & trailing spaces from a string. | |
| void | splitStringOnNewlines (const std::string &pStr, std::list< std::string > &pStrings) |
| Splits a string on newlines. | |
String utility functions.
| bool cxStringUtils::Find | ( | const std::string & | input, |
| const std::string & | regex, | ||
| bool | useBasicRegex = false |
||
| ) |
Performs a regular expression search on a string. Returns true or false, depending on whether or not the regex was found.
| input | The string to search |
| regex | Regular expression to search for |
| useBasicRegex | Specifies whether to use basic regular expressions (when false, extended regular exprssions are used). |
References Find().
| void cxStringUtils::Find | ( | const std::string & | input, |
| const std::string & | regex, | ||
| std::string & | output | ||
| ) |
Performs a regular expression search on a string and copies the resulting string into output.
| input | The string to search |
| regex | Regular expression to search for |
| output | Result string copied here |
References Find().
| int cxStringUtils::indexOfLastCap | ( | const std::string & | pStr | ) |
Returns the index of the last capital letter in a string. Returns -1 if there are no capital letters.
| pStr | The string to search |
References indexOfLastCap().
Referenced by indexOfLastCap().
| void cxStringUtils::insertUnderline | ( | std::string & | pStr, |
| char | pChar, | ||
| bool | pAll = false |
||
| ) |
Inserts an underline character into.
a string for a character.
| pStr | The string into which to insert an underline |
| pChar | The character for which to insert an underline character |
| pAll | Whether or not to underline all occurances of the character in the string (defaults to false) |
| bool cxStringUtils::isPrintable | ( | const int & | pKey | ) |
Returns whether or not a key is printable. This should be used.
instead of isprint() because isprint() returns true for some keys
that cxWidgets does not consider printable, such as pageUp,
pageDown, insert, and mouse clicks.
| pKey | A key to check |
References PAGE_DOWN, and PAGE_UP.
Referenced by startsWithNumber().
| std::string cxStringUtils::removeChar | ( | const std::string & | pString, |
| const int | pPos | ||
| ) |
Removes a character from a string.
| pString | The string to remove the character from |
| pPos | The index of the character to remove |
| std::string cxStringUtils::replace | ( | const std::string & | input, |
| const std::string & | search, | ||
| const std::string & | replace | ||
| ) |
Replaces substrings of a string with another string.
| input | The string to be modified |
| search | The substring to be replaced |
| replace | The string to replace the search string |
References stringTo(), stringToLong(), stringToLongDouble(), and toString().
| bool cxStringUtils::Replace | ( | std::string & | srcStr, |
| const std::string & | regexStr, | ||
| const std::string & | replacementStr | ||
| ) |
Performs a search & replace basd on a regular expression search pattern & a replacement string (the replacemnt string supports backquoting of named paranthetical buffers, i.e. \1, \2, etc.). Returns whether or not the regular expression string was found.
| srcStr | The string on which to perform the search/replace operation |
| regexStr | Regular expression to search for |
| replacementStr | String to replace target with |
Referenced by test_Replace().
| std::string cxStringUtils::replaceNewlines | ( | const std::string & | pStr, |
| const char & | pChar | ||
| ) |
Replaces newlines in a string with another character.
| pStr | The string to process |
| pChar | The character to replace newlines with |
| void cxStringUtils::splitStringOnNewlines | ( | const std::string & | pStr, |
| std::list< std::string > & | pStrings | ||
| ) |
Splits a string on newlines.
| pStr | The string to split |
| pStrings | (OUT) This will contain the resulting lines |
| void cxStringUtils::SplitStringRegex | ( | const std::string & | input, |
| const std::string & | regex, | ||
| std::vector< std::string > & | resultContainer | ||
| ) |
Splits a string based on a regular expression, similar to Perl's split function.
| input | String to split |
| regex | Regular expression used to split string |
| resultContainer | Conainer for strings split off from input |
References SplitStringRegex().
Referenced by cx::cxWindow::init(), SplitStringRegex(), and wrapText().
| bool cxStringUtils::startsWithNumber | ( | const std::string & | pStr | ) |
Returns whether a string starts with a number (positive or negative).
| pStr | The string to test |
References isPrintable().
| int cxStringUtils::stringTo | ( | const std::string & | s | ) |
Converts a string to another type.
| s | A string to be converted. |
Referenced by replace(), and test_stringTo().
| double cxStringUtils::stringToDouble | ( | const std::string & | s | ) |
Referenced by test_stringTo().
| long cxStringUtils::stringToLong | ( | const std::string & | s | ) |
Referenced by replace(), and test_stringTo().
| long double cxStringUtils::stringToLongDouble | ( | const std::string & | s | ) |
Referenced by replace().
| string cxStringUtils::stringToString | ( | const std::string & | s | ) |
Referenced by test_stringTo().
| unsigned cxStringUtils::stringToUnsigned | ( | const std::string & | s | ) |
Referenced by fKeySort(), and test_stringTo().
| std::string cxStringUtils::stripNewlines | ( | const std::string & | pStr | ) |
Strips newlines characters from a string and returns.
the new version of the string.
| pStr | A string to process |
| std::string cxStringUtils::strToLower | ( | const std::string & | theString | ) |
conver the string to lower case
| theString | to convert |
References strToLower().
Referenced by strToLower(), and test_strToLower().
| std::string cxStringUtils::strToUpper | ( | const std::string & | theString | ) |
conver the string to upper case
| theString | to convert |
Referenced by test_strToUpper().
| void cxStringUtils::test_stringTo | ( | ) |
References stringTo(), stringToDouble(), stringToLong(), stringToString(), and stringToUnsigned().
| void cxStringUtils::test_toString | ( | ) |
References cx::cxID_QUIT, cx::eBS_NOBORDER, cx::eINPUT_EDITABLE, and toString().
| std::string cxStringUtils::toString | ( | const cx::eBorderStyle & | x | ) |
| std::string cxStringUtils::toString | ( | const cx::eInputOptions & | x | ) |
| std::string cxStringUtils::toString | ( | const cx::eReturnCode & | x | ) |
| std::string cxStringUtils::toString | ( | const double & | x | ) |
| std::string cxStringUtils::toString | ( | const int & | x | ) |
Converts an object to a string, i.e.:
int x = 12; string xStr = toString(x); *
| x | An object to be converted to a string |
Referenced by changeMenuItemText(), comboBox(), comboBoxMenuDisable(), cx::cxFileViewer::cxFileViewer(), cxMenuAltItemText(), cxMenuAssignment(), cxMenuFocusFunctions(), cxMenuMiscTests(), cxMenuMouseFunctionTest(), cxMenuNoMoreSelectableItemsWhileModal(), cxMenuNoQuit(), cxMenuResize(), cxMenuScrolling(), cxMenuWithMultipleItemHotkeys(), cxMultiLineInputMaxInputLength(), cxNotebookRemoveWindowTest(), cxNotebookSwapTest(), cxNotebookTest1(), cxNotebookWithEmptyPanelTest(), cxPanel_cxMenuUpArrowLeave(), cxPanelDelAllWindowsTest(), cxPanelGetLastWindow(), cxPanelTest(), cxPanelTest2(), cxPanelWindowSwap(), cxWindowAlignTest(), form(), formUpArrowFunction(), formWithMenu(), cx::getBorderStyleStr(), cx::getInputOptionStr(), cx::getInputTypeStr(), cx::getKeyStr(), cx::getMouseStateStr(), cx::getReturnCodeStr(), cx::cxWindow::init(), itemSales(), replace(), stackedFormScrolling2(), test_toString(), and unselectableMenuItem().
| std::string cxStringUtils::toString | ( | const long & | x | ) |
| std::string cxStringUtils::toString | ( | const long double & | x | ) |
| std::string cxStringUtils::toString | ( | const unsigned & | x | ) |
| std::string cxStringUtils::toString | ( | const unsigned long & | x | ) |
| std::string cxStringUtils::toString | ( | const void * | x | ) |
| void cxStringUtils::toUpper | ( | std::string & | theString | ) |
| void cxStringUtils::TrimSpaces | ( | std::string & | str | ) |
Trims leading & trailing spaces from a string.
| str | (INOUT) This string will get its leading & trailing spaces trimmed. |
References TrimSpaces().
Referenced by test_TrimSpaces(), and TrimSpaces().