儲存庫 vbox 的更動 67651
圖例:
- 未更動
- 新增
- 刪除
-
trunk/include/iprt/cpp/ministring.h
r67650 r67651 757 757 */ 758 758 size_t count(const RTCString *pStr, CaseSensitivity cs = CaseSensitive) const; 759 760 /** 761 * Strips leading and trailing spaces. 762 * 763 * @returns this 764 */ 765 RTCString &strip(); 766 767 /** 768 * Strips leading spaces. 769 * 770 * @returns this 771 */ 772 RTCString &stripLeft(); 773 774 /** 775 * Strips trailing spaces. 776 * 777 * @returns this 778 */ 779 RTCString &stripRight(); 759 780 760 781 /** -
trunk/src/VBox/Runtime/common/string/ministring.cpp
r67650 r67651 33 33 *********************************************************************************************************************************/ 34 34 #include <iprt/cpp/ministring.h> 35 #include <iprt/ctype.h> 35 36 36 37 … … 282 283 #endif 283 284 285 286 RTCString &RTCString::strip() 287 { 288 stripRight(); 289 return stripLeft(); 290 } 291 292 293 RTCString &RTCString::stripLeft() 294 { 295 char *psz = m_psz; 296 size_t const cch = m_cch; 297 size_t off = 0; 298 while (off < cch && RT_C_IS_SPACE(psz[off])) 299 off++; 300 if (off > 0) 301 { 302 if (off != cch) 303 { 304 memmove(psz, &psz[off], cch - off + 1); 305 m_cch = cch - off; 306 } 307 else 308 setNull(); 309 } 310 return *this; 311 } 312 313 314 RTCString &RTCString::stripRight() 315 { 316 char *psz = m_psz; 317 size_t cch = m_cch; 318 while (cch > 0 && RT_C_IS_SPACE(psz[cch - 1])) 319 cch--; 320 if (m_cch != cch) 321 { 322 m_cch = cch; 323 psz[cch] = '\0'; 324 } 325 return *this; 326 } 327 328 329 284 330 RTCString RTCString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/) const 285 331 {
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器