43 #ifndef OME_COMMON_STRING_H
44 # define OME_COMMON_STRING_H
46 # include <ome/common/config.h>
69 std::string::size_type pos = str.find_first_not_of(
" \r\n\t\v");
70 if (pos == std::string::npos)
73 return str.substr(pos, std::string::npos);
88 std::string::size_type pos = str.find_last_not_of(
" \r\n\t\v");
89 if (pos == std::string::npos)
92 return str.substr(0, pos + 1);
107 std::string::size_type fpos = str.find_first_not_of(
" \r\n\t\v");
108 if (fpos == std::string::npos)
109 return std::string();
111 std::string::size_type lpos = str.find_last_not_of(
" \r\n\t\v");
112 if (lpos == std::string::npos)
113 return std::string();
115 return str.substr(fpos, lpos - fpos + 1);
125 #define snprintf c99_snprintf
126 #define vsnprintf c99_vsnprintf
129 c99_snprintf(
char* str,
137 va_start(ap, format);
138 count = c99_vsnprintf(str, size, format, ap);
145 c99_vsnprintf(
char* str,
153 count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
155 count = _vscprintf(format, ap);
165 #endif // OME_COMMON_STRING_H
std::string trim(const std::string &str)
Trim leading and trailing whitespace from a string.
Definition: string.h:105
Open Microscopy Environment C++ implementation.
Definition: CoreMetadata.cpp:40
std::string ltrim(const std::string &str)
Trim leading whitespace from a string.
Definition: string.h:67
std::string rtrim(const std::string &str)
Trim trailing whitespace from a string.
Definition: string.h:86