Changeset 68094 in vbox
- Timestamp:
- Jul 24, 2017 12:44:02 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
include/iprt/cpp/ministring.h (modified) (1 diff)
-
src/VBox/Runtime/common/string/ministring.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/ministring.h
r67690 r68094 927 927 */ 928 928 bool startsWith(const RTCString &that, CaseSensitivity cs = CaseSensitive) const; 929 930 /** 931 * Checks if the string starts with the given word, ignoring leading blanks. 932 * 933 * @param pszWord The word to test for. 934 * @param enmCase Case sensitivity selector. 935 * @returns true if match, false if mismatch. 936 */ 937 bool startsWithWord(const char *pszWord, CaseSensitivity enmCase = CaseSensitive) const; 938 939 /** 940 * Checks if the string starts with the given word, ignoring leading blanks. 941 * 942 * @param rThat Prefix to test for. 943 * @param enmCase Case sensitivity selector. 944 * @returns true if match, false if mismatch. 945 */ 946 bool startsWithWord(const RTCString &rThat, CaseSensitivity enmCase = CaseSensitive) const; 929 947 930 948 /** -
trunk/src/VBox/Runtime/common/string/ministring.cpp
r67688 r68094 34 34 #include <iprt/cpp/ministring.h> 35 35 #include <iprt/ctype.h> 36 #include <iprt/uni.h> 36 37 37 38 … … 488 489 } 489 490 491 bool RTCString::startsWithWord(const char *pszWord, CaseSensitivity enmCase /*= CaseSensitive*/) const 492 { 493 const char *pszSrc = RTStrStripL(c_str()); /** @todo RTStrStripL doesn't use RTUniCpIsSpace (nbsp) */ 494 size_t cchWord = strlen(pszWord); 495 if ( enmCase == CaseSensitive 496 ? RTStrNCmp(pszSrc, pszWord, cchWord) == 0 497 : RTStrNICmp(pszSrc, pszWord, cchWord) == 0) 498 { 499 if ( pszSrc[cchWord] == '\0' 500 || RT_C_IS_SPACE(pszSrc[cchWord]) 501 || RT_C_IS_PUNCT(pszSrc[cchWord]) ) 502 return true; 503 RTUNICP uc = RTStrGetCp(&pszSrc[cchWord]); 504 if (RTUniCpIsSpace(uc)) 505 return true; 506 } 507 return false; 508 } 509 510 bool RTCString::startsWithWord(const RTCString &rThat, CaseSensitivity enmCase /*= CaseSensitive*/) const 511 { 512 return startsWithWord(rThat.c_str(), enmCase); 513 } 514 490 515 bool RTCString::contains(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const 491 516 {
Note:
See TracChangeset
for help on using the changeset viewer.

