| glibmm
    2.64.4
    | 
This section describes a number of utility functions for creating and manipulating strings, as well as other string-related stuff. More...
| Functions | |
| bool | Glib::str_has_prefix (const std::string& str, const std::string& prefix) | 
| Looks whether the string str begins with prefix.  More... | |
| bool | Glib::str_has_suffix (const std::string& str, const std::string& suffix) | 
| Looks whether the string str ends with suffix.  More... | |
| double | Glib::Ascii::strtod (const std::string& str) | 
| Converts a string to a doublevalue.  More... | |
| double | Glib::Ascii::strtod (const std::string& str, std::string::size_type& end_index, std::string::size_type start_index=0) | 
| Converts a string to a doublevalue.  More... | |
| std::string | Glib::Ascii::dtostr (double d) | 
| Converts a doubleto a string, using the'.  More... | |
| std::string | Glib::strescape (const std::string& source) | 
| Escapes all special characters in the string.  More... | |
| std::string | Glib::strescape (const std::string& source, const std::string& exceptions) | 
| Escapes all special characters in the string.  More... | |
| std::string | Glib::strcompress (const std::string& source) | 
| Replaces all escaped characters with their one byte equivalent.  More... | |
| Glib::ustring | Glib::strerror (int errnum) | 
| Returns a string corresponding to the given error code, e.g. "no such process".  More... | |
| Glib::ustring | Glib::strsignal (int signum) | 
| Returns a string describing the given signal, e.g. "Segmentation fault".  More... | |
This section describes a number of utility functions for creating and manipulating strings, as well as other string-related stuff.
| std::string Glib::Ascii::dtostr | ( | double | d | ) | 
Converts a double to a string, using the '. 
' as decimal point.
This functions generates enough precision that converting the string back using Glib::Ascii::strtod() gives the same machine-number (on machines with IEEE compatible 64bit doubles).
| d | The doublevalue to convert. | 
| bool Glib::str_has_prefix | ( | const std::string & | str, | 
| const std::string & | prefix | ||
| ) | 
Looks whether the string str begins with prefix.
| str | A string. | 
| prefix | The prefix to look for. | 
true if str begins with prefix, false otherwise. | bool Glib::str_has_suffix | ( | const std::string & | str, | 
| const std::string & | suffix | ||
| ) | 
Looks whether the string str ends with suffix.
| str | A string. | 
| suffix | The suffix to look for. | 
true if str ends with suffix, false otherwise. | std::string Glib::strcompress | ( | const std::string & | source | ) | 
Replaces all escaped characters with their one byte equivalent.
This function does the reverse conversion of Glib::strescape().
| source | A string to compress. | 
| Glib::ustring Glib::strerror | ( | int | errnum | ) | 
Returns a string corresponding to the given error code, e.g. "no such process". 
This function is included since not all platforms support the strerror() function.
| errnum | The system error number. See the standard C errnodocumentation. | 
"unknown error (<errnum>)" is returned. | std::string Glib::strescape | ( | const std::string & | source | ) | 
Escapes all special characters in the string.
Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\' and '"' in the string source by inserting a '\' before them. Additionally all characters in the range 0x01 - 0x1F (everything below SPACE) and in the range 0x80 - 0xFF (all non-ASCII chars) are replaced with a '\' followed by their octal representation.
Glib::strcompress() does the reverse conversion.
| source | A string to escape. | 
| std::string Glib::strescape | ( | const std::string & | source, | 
| const std::string & | exceptions | ||
| ) | 
Escapes all special characters in the string.
Escapes the special characters '\b', '\f', '\n', '\r', '\t', '\' and '"' in the string source by inserting a '\' before them. Additionally all characters in the range 0x01 - 0x1F (everything below SPACE) and in the range 0x80 - 0xFF (all non-ASCII chars) are replaced with a '\' followed by their octal representation. Characters supplied in exceptions are not escaped.
Glib::strcompress() does the reverse conversion.
| source | A string to escape. | 
| exceptions | A string of characters not to escape in source. | 
| Glib::ustring Glib::strsignal | ( | int | signum | ) | 
Returns a string describing the given signal, e.g. "Segmentation fault". 
This function is included since not all platforms support the strsignal() function.
| signum | The signal number. See the signal()documentation. | 
"unknown signal (<signum>)" is returned. | double Glib::Ascii::strtod | ( | const std::string & | str | ) | 
Converts a string to a double value. 
This function behaves like the standard strtod() function does in the C locale. It does this without actually changing the current locale, since that would not be thread-safe.
This function is typically used when reading configuration files or other non-user input that should be locale independent. To handle input from the user you should normally use locale-sensitive C++ streams.
To convert from a string to double in a locale-insensitive way, use Glib::Ascii::dtostr().
| str | The string to convert to a numeric value. | 
double value. | std::overflow_error | Thrown if the correct value would cause overflow. | 
| std::underflow_error | Thrown if the correct value would cause underflow. | 
| double Glib::Ascii::strtod | ( | const std::string & | str, | 
| std::string::size_type & | end_index, | ||
| std::string::size_type | start_index = 0 | ||
| ) | 
Converts a string to a double value. 
This function behaves like the standard strtod() function does in the C locale. It does this without actually changing the current locale, since that would not be thread-safe.
This function is typically used when reading configuration files or other non-user input that should be locale independent. To handle input from the user you should normally use locale-sensitive C++ streams.
To convert from a string to double in a locale-insensitive way, use Glib::Ascii::dtostr().
| str | The string to convert to a numeric value. | |
| start_index | The index of the first character that should be used in the conversion. | |
| [out] | end_index | The index of the character after the last character used in the conversion. | 
double value. | std::out_of_range | Thrown if start_index is out of range. | 
| std::overflow_error | Thrown if the correct value would cause overflow. | 
| std::underflow_error | Thrown if the correct value would cause underflow. |