Changeset 13221 for trunk/FACT++/src/tools.cc
- Timestamp:
- 03/26/12 08:46:02 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/tools.cc
r13168 r13221 76 76 // -------------------------------------------------------------------------- 77 77 // 78 //! This is a static helper to remove leading and trailing whitespaces and 79 //! if available leading and trailing quotes, can be either ' or " 80 //! 81 //! @param buf 82 //! a pointer to the char array to be trimmed 83 //! 84 //! @returns 85 //! a std::string with the content trimmed 86 // 87 string Tools::TrimQuotes(const string &str) 88 { 89 string rc = Trim(str); 90 if (rc.length()<2) 91 return rc; 92 93 const char b = rc[0]; 94 const char e = rc[rc.length()-1]; 95 96 if ((b=='\"' && e=='\"') || (b=='\'' && e=='\'')) 97 return rc.substr(1, rc.length()-2); 98 99 return rc; 100 } 101 102 // -------------------------------------------------------------------------- 103 // 78 104 //! This is a static helper to remove leading and trailing whitespaces. 79 105 //!
Note:
See TracChangeset
for help on using the changeset viewer.