Changeset 39897 in vbox
- Timestamp:
- Jan 27, 2012 3:25:44 PM (13 years ago)
- svn:sync-xref-src-repo-rev:
- 75956
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/ministring.h
r39277 r39897 688 688 * values less than 128; this is not verified. 689 689 * 690 * @param cFind Character to replace. Must be ASCII < 128. 691 * @param cReplace Character to replace cFind with. Must be ASCII < 128. 692 */ 693 void findReplace(char cFind, char cReplace); 690 * @param chFind Character to replace. Must be ASCII < 128. 691 * @param chReplace Character to replace cFind with. Must be ASCII < 128. 692 */ 693 void findReplace(char chFind, char chReplace); 694 695 /** 696 * Count the occurences of the specified character in the string. 697 * 698 * @param ch What to search for. Must be ASCII < 128. 699 * @remarks QString::count 700 */ 701 size_t count(char ch) const; 702 703 /** 704 * Count the occurences of the specified sub-string in the string. 705 * 706 * @param psz What to search for. 707 * @param cs Case sensitivity selector. 708 * @remarks QString::count 709 */ 710 size_t count(const char *psz, CaseSensitivity cs = CaseSensitive) const; 711 712 /** 713 * Count the occurences of the specified sub-string in the string. 714 * 715 * @param pStr What to search for. 716 * @param cs Case sensitivity selector. 717 * @remarks QString::count 718 */ 719 size_t count(const RTCString *pStr, CaseSensitivity cs = CaseSensitive) const; 694 720 695 721 /** -
trunk/src/VBox/Runtime/common/string/ministring.cpp
r39873 r39897 216 216 } 217 217 218 void RTCString::findReplace(char cFind, char cReplace) 219 { 218 void RTCString::findReplace(char chFind, char chReplace) 219 { 220 Assert((unsigned int)chFind < 128U); 221 Assert((unsigned int)chReplace < 128U); 222 220 223 for (size_t i = 0; i < length(); ++i) 221 224 { 222 225 char *p = &m_psz[i]; 223 if (*p == cFind) 224 *p = cReplace; 225 } 226 } 226 if (*p == chFind) 227 *p = chReplace; 228 } 229 } 230 231 size_t RTCString::count(char ch) const 232 { 233 Assert((unsigned int)ch < 128U); 234 235 size_t c = 0; 236 const char *psz = m_psz; 237 char chCur; 238 while ((chCur = *psz++) != '\0') 239 if (chCur == ch) 240 c++; 241 return c; 242 } 243 244 #if 0 /** @todo implement these when needed. */ 245 size_t RTCString::count(const char *psz, CaseSensitivity cs = CaseSensitive) const 246 { 247 } 248 249 size_t RTCString::count(const RTCString *pStr, CaseSensitivity cs = CaseSensitive) const 250 { 251 252 } 253 #endif 227 254 228 255 RTCString RTCString::substrCP(size_t pos /*= 0*/, size_t n /*= npos*/) const
Note:
See TracChangeset
for help on using the changeset viewer.