00001 // This is core/vul/vul_string.h 00002 #ifndef vul_string_h 00003 #define vul_string_h 00004 //: 00005 // \file 00006 // \brief Utility functions for C strings and vcl_strings 00007 00008 #include <vcl_string.h> 00009 00010 // C string functions: 00011 00012 //: Converts all alphabetical characters to uppercase. 00013 extern char* vul_string_c_upcase(char*); 00014 //: Converts all alphabetical characters to lowercase. 00015 extern char* vul_string_c_downcase(char*); 00016 //: Capitalizes all words in a string. 00017 // A word is defined as a sequence of characters separated by 00018 // non-alphanumerics. 00019 extern char* vul_string_c_capitalize(char*); 00020 //: Removes any occurrences of rem from str, and returns the modified string. 00021 extern char* vul_string_c_trim(char* str, const char* rem); 00022 //: Removes any prefix occurrence of rem from str and returns modified string. 00023 extern char* vul_string_c_left_trim(char* str, const char* rem); 00024 //: Removes any suffix occurrence of rem from str and returns modified string. 00025 extern char* vul_string_c_right_trim(char* str, const char* rem); 00026 //: Reverses the order of the characters in string. 00027 extern char* vul_string_c_reverse(char*); 00028 00029 // vcl_string functions: 00030 00031 //: Converts all alphabetical characters to uppercase. 00032 extern vcl_string& vul_string_upcase(vcl_string&); 00033 //: Converts all alphabetical characters to lowercase. 00034 extern vcl_string& vul_string_downcase(vcl_string&); 00035 //: Capitalizes all words in string. 00036 extern vcl_string& vul_string_capitalize(vcl_string&); 00037 //: Removes any occurrences of rem from str and returns modified string 00038 extern vcl_string& vul_string_trim(vcl_string&, const char*); 00039 //: Removes any prefix occurrence of rem from str and returns modified string 00040 extern vcl_string& vul_string_left_trim(vcl_string&, const char*); 00041 //: Removes any suffix occurrence of rem from str and returns modified string 00042 extern vcl_string& vul_string_right_trim(vcl_string&, const char*); 00043 //: Reverses the order of the characters in string 00044 extern vcl_string& vul_string_reverse(vcl_string&); 00045 00046 //: Reads an integer from a string 00047 extern int vul_string_atoi(vcl_string const&); 00048 00049 //: Reads an double from a string 00050 extern double vul_string_atof(vcl_string const& s); 00051 00052 //: Convert a string to a boolean. 00053 // Looks for On, true, yes, 1 to mean true. everything else is false. 00054 // It ignores leading and trailing whitespace and capitalisation. 00055 extern bool vul_string_to_bool(const vcl_string &str); 00056 00057 //: Expand any environment variables in the string. 00058 // \verbatim 00059 // Expands "foo$VARfoo" to "foobarfoo" when $VAR=bar. If 00060 // both $VAR and $VARfoo exists, an arbitrary choice will 00061 // be made of which variable to use. This problem can 00062 // be avoided by using the syntax "foo${VAR}foo." "$(VAR)" and 00063 // "$[VAR]" can also be used. There are no inbuilt variables 00064 // like in shell scripting. "$$" can be used to insert a 00065 // literal "$" in to the output. 00066 // \endverbatim 00067 // \returns false if a matching variable could not be found. 00068 extern bool vul_string_expand_var(vcl_string &str); 00069 00070 00071 #endif // vul_string_h
1.4.4