Xmipp
v3.23.11-Nereus
|
#include <vector>
#include <string>
#include <string.h>
Go to the source code of this file.
Macros | |
#define | STR_EQUAL(str1, str2) (strcmp((str1), (str2)) == 0) |
Typedefs | |
typedef std::string | String |
typedef std::vector< String > | StringVector |
Functions | |
String | removeChar (const String &str, char character) |
String | unescape (const String &str) |
int | bestPrecision (float F, int _width) |
float | textToFloat (const char *str) |
float | textToFloat (const String &str) |
int | textToInteger (const char *str) |
size_t | textToSizeT (const char *str) |
int | textToInteger (const String &str) |
long long | textToLongLong (const char *str) |
String | floatToString (float F, int _width=8, int _prec=0) |
String | integerToString (int I, int _width=0, char fill_with='0') |
int | charToInt (const char *str) |
String | stringToString (const String &str, size_t _width=0) |
void | checkAngle (const String &str) |
void | toLower (char *_str) |
void | toLower (String &_str) |
String | simplify (const String &str) |
void | trim (String &str) |
String | removeSpaces (const String &_str) |
void | removeQuotes (char **_str) |
String | findAndReplace (const String &tInput, const String &tFind, const String &tReplace) |
String | formatString (const char *format,...) |
void | formatStringFast (String &str, const char *format,...) |
bool | matchRegExp (const String &inputString, const String &pattern) |
String | WordWrap (const String &inputString, size_t lineLength) |
String | escapeForRegularExpressions (const String &str) |
bool | endsWith (const char *str1, const char *str2) |
Tokenization | |
These functions allow to split a string into small pieces separated by blank spaces, giving you a pointer to the different word each time. The different elements from the string are selected using strtok, so after the application of this function to the input string, this is modified and NULL characters are introduced as delimiters of the elements. This is useful in most situations since after reading a list you might go on reading more things, but you must be aware of it. Here goes an example of doing so: std::cout << "Whole line: " << line << std::endl; std::cout << "First word: " << firstToken(line) << std::endl; std::cout << "Second word: " << nextToken() << std::endl; std::cout << "Third word: " << nextToken() << std::endl; ... When there are no more words, both functions return a NULL pointer. Here we make a distinction between tokens (words that might be empty) and words (words that cannot be empty, if they are then an exception or an exit error is thrown). For STL there is another way. You supply a string object and a vector of strings is returned with all the elements | |
int | splitString (const String &input, const String &delimiter, StringVector &results, bool includeEmpties=false) |
char * | firstToken (const char *str) |
char * | firstToken (const String &str) |
char * | nextToken () |
String | nextToken (const String &str, size_t &i) |
char * | firstWord (char *str) |
char * | firstWord (String &str) |
char * | nextWord () |
void | tokenize (const String &str, StringVector &tokens, const String &delimiters=" \) |
char * | memtok (char **src, char **_end, const char *sep) |
void * | _memmem (const void *haystack, size_t haystack_len, const void *needle, size_t needle_len) |
typedef std::string String |
Definition at line 34 of file xmipp_strings.h.
typedef std::vector<String> StringVector |
Definition at line 35 of file xmipp_strings.h.