Library in C++ that implements operations over the STL string.
The main file that contains all functions.
File that contains the test functions to check if everything is working.
- split
- str_to_float
- float_to_str
- isInt
- isFloat
- capitalize
- check_regex_exp
- trim
- split
- find_full_words
- find_replace_first
- find_replace_all
- find_term
- reduce
- mismatch_string
- vec_float_to_str
- vec_str_to_float
- indexOf
- contains
Aux function for split
Templates:
- Out, typename
Return type: void
Access: private
Arguments:
Type: std::string,Name: sType: char,Name: delimType: Out,Name: result
Cast std::string val to float
Templates:
- f, typename
Return type: f
Access: private
Arguments:
Type: std::string,Name: val
Cast float val to std::string.
Templates:
- f, typename
Return type: std::string
Access: private
Arguments:
Type: f,Name: val
Checks if val is a integer.
Return type: bool
Access: public
Arguments:
Type: std::string,Name: val
Checks if val is any kind of float.
Return type: bool
Access: public
Arguments:
Type: std::string,Name: val
Capitalize the first char of str.
Return type: std::string
Access: public
Arguments:
Type: std::string,Name: str
Creates a regex expression using the string exp and checks if there is a match in str. If it throws an exception (problably because your exp was wrong), put the function call in a try/catch and do something like: catch (std::exception &e) {print(e.what())}
Return type: bool
Access: public
Arguments:
Type: std::string,Name: strType: std::string,Name: exp
Returns the "trimmed" str (can be another char besides whitespace). E.g.: " trim me " -> "trim me".
Return type: std::string
Access: public
Arguments:
Type: std::string,Name: strType: std::string,Name: whitespaceDefault value: " "
Returns a vector with the split string s spliting at delim char.
Return type: std::vectorstd::string
Access: public
Arguments:
Type: std::string,Name: sType: char,Name: delimDefault value: ' '
Checks if there is a full word in s.
Return type: bool
Access: public
Arguments:
Type: std::string,Name: sType: std::string,Name: word
Replace the first occurrence of string toReplace with replaceWith in a copy of s. Returns the replaced string, if not replaced it'll return the copy of s.
Return type: std::string
Access: public
Arguments:
Type: std::string,Name: sType: std::string,Name: toReplaceType: std::string,Name: replaceWith
Replace all occurrence of string toReplace with replaceWith in a copy of s. Returns the replaced string, if not replaced it'll return the copy of s.
Return type: std::string
Access: public
Arguments:
Type: std::string,Name: sType: std::string,Name: toReplaceType: std::string,Name: replaceWith
Checks if the term is in s.
Return type: bool
Access: public
Arguments:
Type: std::string,Name: sType: std::string,Name: term
Removes the whitespace (or another char) from str and fill the gap with fill. E.g.: " there is too much empty space" -> "there-is-too-much-empty-space" or "there is too much empty space".
Return type: std::string
Access: public
Arguments:
Type: std::string,Name: strType: std::string,Name: fillDefault value: " "Type: std::string,Name: whitespaceDefault value: " "
Removes the begin of a that matches b. Useful for handling paths. E.g.: "/this/is/a/path/to/something.txt" - "/this/is/a/path/" = "to/something.txt"
Return type: std::string
Access: public
Arguments:
Type: std::string,Name: aType: std::string,Name: b
Transforms a float (or double, or whatever float it is) vector float_v to a std::string vector.
Templates:
- f, typename
Return type: std::vectorstd::string
Access: public
Arguments:
Type: std::vector,Name: float_v
Transforms a std::string vector str_v to a float (or double, or whatever float it is). You need to specify the return type, e.g.: vec_str_to_float<double>(string_vector)
Templates:
- f, typename
Return type: std::vector
Access: public
Arguments:
Type: std::vectorstd::string,Name: str_v
Returns the index of first occurence of val inside of vec. If not found, returns -1.
Templates:
- T, typename
Return type: int
Access: public
Arguments:
Type: std::vector,Name: vecType: T,Name: val
Uses indexOf to check if val is in vec.
Templates:
- T, typename
Return type: bool
Access: public
Arguments:
Type: std::vector,Name: vecType: T,Name: val
Python-like print.
Templates:
- T, typename
- TAIL, typename
Return type: void
Access: public
Arguments:
Type: T,Name: tType: TAIL...,Name: tail