14 #ifndef STRING_UTILS_H 15 #define STRING_UTILS_H 25 EXPCL_DTOOL_DTOOLUTIL
int cmp_nocase(
const std::string &s,
const std::string &s2);
28 EXPCL_DTOOL_DTOOLUTIL
int cmp_nocase_uh(
const std::string &s,
const std::string &s2);
31 EXPCL_DTOOL_DTOOLUTIL std::string
downcase(
const std::string &s);
34 EXPCL_DTOOL_DTOOLUTIL std::string
upcase(
const std::string &s);
37 EXPCL_DTOOL_DTOOLUTIL
int extract_words(
const std::string &str, vector_string &words);
41 EXPCL_DTOOL_DTOOLUTIL
void tokenize(
const std::string &str, vector_string &words,
42 const std::string &delimiters,
43 bool discard_repeated_delimiters =
false);
45 const std::wstring &delimiters,
46 bool discard_repeated_delimiters =
false);
49 EXPCL_DTOOL_DTOOLUTIL std::string
trim_left(
const std::string &str);
50 EXPCL_DTOOL_DTOOLUTIL std::wstring
trim_left(
const std::wstring &str);
51 EXPCL_DTOOL_DTOOLUTIL std::string
trim_right(
const std::string &str);
52 EXPCL_DTOOL_DTOOLUTIL std::wstring
trim_right(
const std::wstring &str);
53 EXPCL_DTOOL_DTOOLUTIL std::string
trim(
const std::string &str);
54 EXPCL_DTOOL_DTOOLUTIL std::wstring
trim(
const std::wstring &str);
57 EXPCL_DTOOL_DTOOLUTIL
int string_to_int(
const std::string &str, std::string &tail);
58 EXPCL_DTOOL_DTOOLUTIL
bool string_to_int(
const std::string &str,
int &result);
59 EXPCL_DTOOL_DTOOLUTIL
double string_to_double(
const std::string &str, std::string &tail);
60 EXPCL_DTOOL_DTOOLUTIL
bool string_to_double(
const std::string &str,
double &result);
61 EXPCL_DTOOL_DTOOLUTIL
bool string_to_float(
const std::string &str,
float &result);
62 EXPCL_DTOOL_DTOOLUTIL
bool string_to_stdfloat(
const std::string &str, PN_stdfloat &result);
67 INLINE std::string format_string(
const Thing &thing);
70 INLINE std::string format_string(
const std::string &value);
71 INLINE std::string format_string(
bool value);
72 INLINE std::string format_string(
float value);
73 INLINE std::string format_string(
double value);
74 INLINE std::string format_string(
unsigned int value);
75 INLINE std::string format_string(
int value);
76 INLINE std::string format_string(int64_t value);
EXPCL_DTOOL_DTOOLUTIL int extract_words(const std::string &str, vector_string &words)
Divides the string into a number of words according to whitespace.
EXPCL_DTOOL_DTOOLUTIL std::string trim(const std::string &str)
Returns a new string representing the contents of the given string with both leading and trailing whi...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL vector.
EXPCL_DTOOL_DTOOLUTIL void tokenize(const std::string &str, vector_string &words, const std::string &delimiters, bool discard_repeated_delimiters=false)
Chops the source string up into pieces delimited by any of the characters specified in delimiters.
EXPCL_DTOOL_DTOOLUTIL std::string trim_left(const std::string &str)
Returns a new string representing the contents of the given string with the leading whitespace remove...
EXPCL_DTOOL_DTOOLUTIL double string_to_double(const std::string &str, std::string &tail)
A string-interface wrapper around the C library strtol().
EXPCL_DTOOL_DTOOLUTIL int string_to_int(const std::string &str, std::string &tail)
A string-interface wrapper around the C library strtol().
EXPCL_DTOOL_DTOOLUTIL std::string downcase(const std::string &s)
Returns the input string with all uppercase letters converted to lowercase.
EXPCL_DTOOL_DTOOLUTIL std::string trim_right(const std::string &str)
Returns a new string representing the contents of the given string with the trailing whitespace remov...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
EXPCL_DTOOL_DTOOLUTIL std::string upcase(const std::string &s)
Returns the input string with all lowercase letters converted to uppercase.