43 #ifndef OME_COMMON_STRING_H
44 # define OME_COMMON_STRING_H
46 # include <ome/common/config.h>
68 std::string::size_type pos = str.find_first_not_of(
" \r\n\t\v");
69 if (pos == std::string::npos)
72 return str.substr(pos, std::string::npos);
87 std::string::size_type pos = str.find_last_not_of(
" \r\n\t\v");
88 if (pos == std::string::npos)
91 return str.substr(0, pos + 1);
106 std::string::size_type fpos = str.find_first_not_of(
" \r\n\t\v");
107 if (fpos == std::string::npos)
108 return std::string();
110 std::string::size_type lpos = str.find_last_not_of(
" \r\n\t\v");
111 if (lpos == std::string::npos)
112 return std::string();
114 return str.substr(fpos, lpos - fpos + 1);
124 #define snprintf c99_snprintf
125 #define vsnprintf c99_vsnprintf
128 c99_snprintf(
char* str,
136 va_start(ap, format);
137 count = c99_vsnprintf(str, size, format, ap);
144 c99_vsnprintf(
char* str,
152 count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
154 count = _vscprintf(format, ap);
164 #endif // OME_COMMON_STRING_H
std::string trim(const std::string &str)
Trim leading and trailing whitespace from a string.
Definition: string.h:104
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:66
std::string rtrim(const std::string &str)
Trim trailing whitespace from a string.
Definition: string.h:85