VirtualBox

Ignore:
Timestamp:
Oct 4, 2023 7:30:37 PM (16 months ago)
Author:
vboxsync
Message:

IPRT/ministring: Added C-style endsWith methods.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/string/ministring.cpp

    r98103 r101343  
    10381038}
    10391039
     1040bool RTCString::endsWith(const char *a_pszSuffix, size_t a_cchSuffix) const RT_NOEXCEPT
     1041{
     1042    Assert(RTStrNLen(a_pszSuffix, a_cchSuffix) == a_cchSuffix);
     1043    return a_cchSuffix >  0
     1044        && a_cchSuffix <= length()
     1045        && ::memcmp(&m_psz[length() - a_cchSuffix], a_pszSuffix, a_cchSuffix) == 0;
     1046}
     1047
     1048bool RTCString::endsWith(const char *a_pszSuffix) const RT_NOEXCEPT
     1049{
     1050    return endsWith(a_pszSuffix, strlen(a_pszSuffix));
     1051}
     1052
     1053bool RTCString::endsWithI(const char *a_pszSuffix, size_t a_cchSuffix) const RT_NOEXCEPT
     1054{
     1055    Assert(RTStrNLen(a_pszSuffix, a_cchSuffix) == a_cchSuffix);
     1056    return a_cchSuffix >  0
     1057        && a_cchSuffix <= length()
     1058        && ::RTStrNICmp(&m_psz[length() - a_cchSuffix], a_pszSuffix, a_cchSuffix) == 0;
     1059}
     1060
     1061bool RTCString::endsWithI(const char *a_pszSuffix) const RT_NOEXCEPT
     1062{
     1063    return endsWithI(a_pszSuffix, strlen(a_pszSuffix));
     1064}
     1065
    10401066bool RTCString::startsWith(const RTCString &that, CaseSensitivity cs /*= CaseSensitive*/) const RT_NOEXCEPT
    10411067{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette